3

我正在玩leanback库,我可以看到leanback包中的大部分RowsFragment,它们使用Horizo​​ntalGridView或VerticalGridView,但是当我创建一个新的Horizo​​ntalGridView时,没有绘制焦点,这意味着我不能使用我的遥控器滚动到该项目。

有谁知道该怎么做?

我还可以看到一些演示者正在使用 ItemBridgeAdapter 作为 VerticalGridView 或 Horizo​​ntalGridView,这与获取视图的焦点有关吗?

4

1 回答 1

2

One possibility that I can think of that's causing this is that you haven't set your custom view to be both setFocusable(true) and setFocusableInTouchMode(true). You need these for whatever controls that you put into Leanback in order for the remote focus model to work.

You can do these in both code and xml; in xml via android:focusable="true" and android:focusableInTouchMode="true" on the top level view that you want as your UI or card.

于 2016-07-28T14:20:18.867 回答