有很多软件都喜欢用ListView,然后带CheckBox选项

有很多软件都喜欢用ListView,然后带CheckBox选项_第1张图片

public class MainActivity   extends ListActivity {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_multiple_choice, GENRES));
//android.R.layout.simple_list_item_multiple_choice引用系统的布局        
        final ListView listView = getListView();

        listView.setItemsCanFocus(false);
        listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    }


    private static final String[] GENRES = new String[] {
        "Action", "Adventure", "Animation", "Children", "Comedy", "Documentary", "Drama",
        "Foreign", "History", "Independent", "Romance", "Sci-Fi", "Television", "Thriller"
    };
}


没有xml

你可能感兴趣的:(list,ListView,String,Class,animation,action)