How to use D-pad navigate switch between listview's row and it's decendants (Google-TV support)

henry74918 picture henry74918 · Jan 18, 2013 · Viewed 12.2k times · Source

I have a listview which has an imageview inside each list item, when user click on that imageview, it will pop-up a menu.

It works very well on a normal android device with a touch screen.

But now I want to support google-tv, which app should be control by D-pad.

When I use D-pad to navigate through listview, only the entire row can be focus, I can't get the imageview inside listview be focus.

I try to add android:focusable="true" to imageview, but it cause the entire listview can't receive onItemClick event.

Does anyone know how to move the focus between listview rows and item inside listview using d-pad also keeps listview and imageview clickable?

Thanks a lot!

Answer

Matthias picture Matthias · Jan 19, 2013

You have to set the following for your ListView:

listView.setItemsCanFocus(true);

With that focusable views inside of your listItems won't be ignored.