【问题标题】:state_hovered Google TVstate_hovered 谷歌电视
【发布时间】:2011-12-02 13:55:52
【问题描述】:

有人知道如何让 state_hovered 在 GoogleTv 上被识别吗?我意识到这是 14 级 Android 4.0 的新功能,所以我原以为电视也会识别它。这是我的布局和 xml 选择器:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="50dp"
  android:layout_height="100dp"
  android:orientation="vertical"> 

    <Button 
        android:id="@+id/zoom_in"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@xml/zoom_in_selector" />

    <Button 
        android:id="@+id/zoom_out"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@xml/zoom_out_selector" />

</LinearLayout> 


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
          android:drawable="@drawable/plus_downpressed" /> <!-- pressed -->
    <item android:state_focused="true"
          android:drawable="@drawable/plus_highlight" /> <!-- focused -->
    <item android:state_hovered="true"
          android:drawable="@drawable/plus_highlight" /> <!-- hovered -->
    <item android:state_pressed="false"
          android:drawable="@drawable/plus" /> <!-- default -->
</selector>

【问题讨论】:

    标签: xml selector google-tv


    【解决方案1】:

    Google TV 目前是 API 12,而不是 14。因此,这是不可能的。也就是说,您可以在代码中使用 onGenericMotion 事件来实现悬停。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多