Currently I am working on Android TV app.
I have used Android Lean back support library.
I have added one ListView
, but I can not able to select
Finally I got the solution after lots of R&D.
Here is the my solution for directional navigation using Android TV remote.
Firstly, you have to keep focus of any one of items (i.e. Button
, TextView
, etc.) as below.
And also, you have to apply its nextFocusDown
, nextFocusLeft
, nextFocusRight
& nextFocusUp
properties, so that it will fire its relevant event when you click TV remote navigation buttons.
<Button
android:id="@+id/btnSignout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tvUserName"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@+id/ivUser"
android:width="100dp"
android:nextFocusRight="@+id/ivUser" <!-- On click of right arrow button, focus will be move to ivUser id -->
android:nextFocusUp="@+id/tvUserName" <!-- On click of up arrow button, focus will be move to tvUserName id -->
android:text="@string/signout"
android:textAppearance="?android:textAppearanceMedium">
<requestFocus></requestFocus>
</Button>
For more information, you can refer to: