Highlight ListView selected row

前端 未结 12 1513
情歌与酒
情歌与酒 2020-11-27 16:04

I have a list of albums (several hundred). When I touch the selected album I want to offer the user a choice of playing the whole album, or moving to its track ListView. No

12条回答
  •  猫巷女王i
    2020-11-27 16:28

    Implement your list with single choice mode: android:choiceMode=singleChoice

    Just as the default android.R.layout.simple_list_item_single_choice uses a RadioButton to denote the selected choice, you can implement a custom highlight state or similar in your list item layout to respond to the choice changes. Methods like getCheckedItemPosition() can be used by your application to determine which item the user currently has chosen, if necessary.

    Hope that Helps!

提交回复
热议问题