将键盘事件传递给gridview?

时间:2012-09-10 19:22:20

标签: android keyboard google-tv

我有一个谷歌电视的自定义布局,并使布局工作,我覆盖我的活动中的dispatchkeyEvent,以使我的布局与dpad一起使用。我的布局也使用gridview,因为我覆盖了dispatchKeyEvent,所以我不能将dpad与gridview一起使用。无论如何将键事件传递给gridview以便我可以使用它吗?

Edit1:显然,无法根据.isFocusable()聚焦gridview。反正是否迫使它变得可以专注?

Edit2:我认为问题是VideoView正在从所有控件中获得焦点? 继承人我正在使用的布局。如果我取出VideoView,我可以使用控件。 UI和工作区布局是我在视频上的UI覆盖。有没有办法解决这个问题?

<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>

0 个答案:

没有答案