views:

70

answers:

1

I've got a ListView that works just great, except for this minor annoyance. I can use the trackball/dpad to move up and down my list, and the background changes according to which row has focus. But when I touch the row (click or long click), there's no background change letting me know what's been focused. I've tried setting 'focusable' and 'focusable in touch mode' to true on the rows, but it still doesn't work.

Just in case it matters somehow:

  • I am setting onClickListeners for each row.
  • The row is comprised of LinearLayouts, TextViews, and a single ImageView.
  • Focusable/clickable is 'true' for each row. Have not specified values for these on the ListView.
  • Trackable does act funny. I can only move between rows after touching inside the ListView. If I scroll trackball above the first item, it's impossible for me to scroll back into the list.

Any thoughts?

+1  A: 

I can use the trackball/dpad to move up and down my list, and the background changes according to which row has focus.

No, it doesn't. The background changes according to which row is selected. Selection and focus are not quite the same thing.

But when I touch the row (click or long click), there's no background change letting me know what's been focused.

"In touch mode, there is no focus and no selection."

CommonsWare
Thanks for guiding me in the right direction. I'd still like the user to see which row they've 'clicked' (in touch mode) though. Any suggestions/advice on that?
Colin O'Dell
@colinodell: Add checkboxes or radio buttons using `setChoiceMode()` (or `android:choiceMode` from your layout) and appropriate modifications to your row layouts to use `CheckedtextView`.
CommonsWare