安卓电视上 Layout 焦点没有颜色,不知道在哪,全靠猜。
Android LinearLayout 点击背景颜色改变_weixin_33737134的博客-CSDN博客
1.布局
<LinearLayout
android:id="@+id/linearLayout_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_rowWeight="1"
android:layout_columnWeight="1"
android:clickable="true"
android:focusable="true"
android:onClick="onClick"
android:background="@drawable/linearlayout_background">
......
</LinearLayout>
2.Drawable
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/colorFocus" />
<item android:state_pressed="true" android:drawable="@color/colorPress" />
<item android:drawable="@color/colorNormal" />
</selector>
3.Color
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorNormal">#FFF</color>
<color name="colorFocus">#DDD</color>
<color name="colorPress">#EEE</color>
</resources>
?
焦点背景有了,点击背景还是没有。
|