listview setItemChecked doesn't work

后端 未结 1 571
迷失自我
迷失自我 2021-01-04 12:05

For some reason setItemChecked doesn\'t work. can some one help me fix ti ?

String[] str = getResources().getStringArray(R.array.brush_type);
sizeArrayAdapte         


        
相关标签:
1条回答
  • 2021-01-04 12:14

    The docs say this:

    Sets the checked state of the specified position. The is only valid if the choice mode has been set to CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE.

    So you might try:

    list.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    

    before calling setItemChecked.

    0 讨论(0)
提交回复
热议问题