1

I have a custom layout for the google tv and to get the layout to work, I override the dispatchkeyEvent in my activity to get my layout to work with the dpad. My layout also uses the gridview, and since I override the dispatchKeyEvent, I cant use the dpad with the gridview. Is there anyway to pass the key event to the gridview so I can use it?

Edit1: Apparently, the gridview cannot be focusd according to .isFocusable(). Is there anyway to force it to become focusable?

Edit2: I think the problem is the VideoView that is taking focus from all the controls? Heres the layout I'm using. If I take out the VideoView, i am able to use the controls. The UI and Workspace layouts is my UI overlay over the video. Is there anway to get around this?

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:layout_weight="1" >

    <VideoView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <RelativeLayout
        android:id="@+id/ui"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="bottom" >

        <LinearLayout
            android:id="@+id/workspace"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="bottom" >
        </LinearLayout>
    </RelativeLayout>

</FrameLayout>
heero
  • 1,941
  • 5
  • 23
  • 33
  • It's impossible to tell without seeing your relevant code, but if your GridView receives focus you can use: `return gridView.isFocused()`, since `dispatchKeyEvent()` passes the events on when you return `true`. – Sam Sep 10 '12 at 20:10
  • I used requestFocus on the gridview and focusable="true" in the layout and it didnt get the focus. – heero Sep 10 '12 at 21:35
  • Apparently the gridview is not able to be focusable according to .isFocusable(). anyway to force this to be focusable? – heero Sep 10 '12 at 21:59

0 Answers0