I have this grid view. The issue is: the focus doesn't lock at left side. Means, if user presses left (DPAD_LEFT) when left-most-item is focused, the focus goes to the previous view. This doesn't happen for the right-most-item, when user presses right when the right-most-item is focused, it does nothing (which was expected for the left-most-item as well).
Here's the xml, it resides in a FrameLayout
in a Fragment
:
<android.support.v17.leanback.widget.ScaleFrameLayout
android:layout_marginTop="@dimen/menu_margin"
android:background="@android:color/transparent"
android:id="@+id/scale_frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v17.leanback.widget.VerticalGridView
android:id="@+id/container_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v17.leanback.widget.ScaleFrameLayout>
I tried the following in the Activity
without getting the log message printed:
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
Log.i(TAG, "key: " + event?.keyCode)
return super.onKeyDown(keyCode, event)
}
What I want: I want to lock the focus, so that pressing left while focus is on the left-most-item does nothing.