Showing the current selection in a listview

What Gmail and similar apps use is the activated state, with an appropriate row layout. See:

In a nutshell, you:

  • Use a row layout with an activated background (e.g., android.R.layout.simple_list_item_activated_1)
  • Use setChoiceMode(ListView.CHOICE_MODE_SINGLE) on your ListView
  • “Check” the row that should be activated using setItemChecked() on your ListView to enable the “activated” state and have the persistent highlight

Leave a Comment