这真的很奇怪.
当我使用标准ArrayAdapter进行ListView调用时,setItemChecked工作正常
但是当使用定制的ArrayAdapter时却没有.
那是什么原因?这是一个错误吗?或者我错过了什么?
public class Test_Activity extends Activity {
/** Called when the activity is first created. */
private List<Model> list;
private ListView lView;
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
// Create an array of Strings, that will be put to our ListActivity
setContentView(R.layout.main);
lView = (ListView) findViewById(R.id.ListView01);
lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
list = getModel();
//with this adapter setItemChecked works OK
lView.setAdapter(new ArrayAdapter<Model>(this,
android.R.layout.simple_list_item_multiple_choice, list));
//**************************
//PROBLEM: with this adapter it does not check any items on the screen
// ArrayAdapter<Model> adapter …Run Code Online (Sandbox Code Playgroud)