我有一个侧面导航菜单,我希望能够将其与方向键一起使用。我正在用java编码。我有按钮状态的 xml 文档,当我的方向键位于项目上但未选中(按确定)时,无法显示状态。我可以向下导航到下一个,状态保持不变,然后按确定,然后显示与此选项卡关联的新屏幕。我想向用户展示他们悬停在下一个项目上。怎么办?
最佳答案
不确定它在 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>
关于java - 使用 Google TV Dpad 的悬停状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8168027/