Google TV Dpad 的悬停状态

3

我有一个侧边导航菜单,想要能够使用dpad进行操作。我在使用java进行编码。我有一个XML文档用于按钮状态,但当我的dpad在项目上但未被选中时(按下确定),无法显示状态。我可以向下导航到下一个项目,状态保持不变,然后按下确定,与此选项卡相关联的新屏幕会显示出来。我想向用户展示他们悬停在下一个项目上的情况。如何做到呢?

1个回答

2

不确定在Google TV上是否有所不同,但是android:state_focused="true"应该是您在状态列表中想要的。

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/buttonpressed"
          android:state_pressed="true" />

    <item android:drawable="@drawable/buttonfocused"
          android:state_focused="true" />

    <item android:drawable="@drawable/button" 
    />
</selector>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接