How to highlight row in ListView in Android?

后端 未结 8 1490
天涯浪人
天涯浪人 2020-11-27 06:05

I need to highlight a row in a ListView that was selected (to show the user what he chose), so, it\'s not the one that is going to be chosen, it\'s the one he c

8条回答
  •  无人及你
    2020-11-27 06:31

    Why dont you store the selections in an array, then pass that array in the constructor of the ListView Array Adapter, something like myArrayAdapter(context,layoutID,dataArray,selectionArray)

    then in your getView method for the arrayadapter, just do a check. For example in pseudocode

    if row was previously selected
        change background color
    

提交回复
热议问题