Search code examples
androidbuttonfocusgoogle-tvlost-focus

Button focused state getting lost : Google TV


In my Google TV application, there are around 6 buttons with all that pressed, focused, enabled etc. states with them.

All buttons have got same pressed, focused, enabled etc. states in a xml file as below.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/default_bt" android:state_enabled="true" android:state_pressed="true"/> <!-- pressed -->
<item android:drawable="@drawable/default_bt" android:state_enabled="false" /> <!-- disabled -->
<item android:drawable="@drawable/default_bt_hvr" android:state_focused="true"/> <!-- focused -->
<item android:drawable="@drawable/default_bt_hvr"/> <!-- default -->

</selector>

Using Google TV remote, if I start moving to the left side, buttons shifting their focus and when I reach the leftmost button, focus remains on the leftmost button.

From that position (leftmost), if I start moving right, focus is coming till rightmost button but goes missing after that.

Is it accepted behavior or something wrong with it?

Any help is greatly appreciated.


Solution

  • It was not a general case.

    So, I managed to bring the focus back with view.requestFocus() wherever required;