1
任何人都知道如何讓state_hovered在GoogleTv上得到認可?我意識到這是14級Android 4.0的新增功能,所以我只會認爲電視也能識別它。這裏是我的佈局和xml選擇器:state_hovered Google TV
<?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>