1

I have a view(Let's say it is MyFramLayout) extends FrameLayout, I can not get this FrameLayout get focus when press key(I am working in TV platform).

the layout is something like this:

<LinearLayout android:layout_width="match_parent"
              android:layout_height="match_parent">

    <ListView android:id="@android:id/list"
              android:layout_width="match_parent"
              android:layout_height="wrap_content" />

    <com.roger.MyFrameLayout 
              android:id="@android:id/my_frame"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:focusable="true"
              android:focusableInTouchMode="true" />

</LinearLayout>

Anyway to fix the problem?

roger
  • 9,063
  • 20
  • 72
  • 119

1 Answers1

1

Whenever you want your custom layout to get focus you will have to call

boolean b = yourLayout.requestFocus();

This will return a whether focus is gained or not.

Nanites
  • 410
  • 3
  • 16