布局使用selector不变色问题
16lz
2022-05-18
在工作的时候想给LinearLayout添加一种变色效果,结果按照最初的思路设置没有任何效果 通过查找各种资料发现了问题所在,当给LinearLayout,RelativeLayout等设置selector时,需要给他们设置android:clickable="ture"属性
android:background="@drawable/selector_hot_dest"
android:clickable="true"
<?xmlversion="1.0"encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android"><itemandroid:drawable="@drawable/item_pop_hot_destination_bg"android:state_pressed="false"/><itemandroid:drawable="@drawable/item_pop_hot_destination_bg_press"android:state_selected="true"/><itemandroid:drawable="@drawable/item_pop_hot_destination_bg_press"android:state_pressed="true"/></selector>
更多相关文章
- 如何让Android字体自适应屏幕分辨率
- 关于设置activity样式
- android:windowSoftInputMode属性使用
- Android动画效果translate、scale、alpha、rotate
- Android(安卓)用Shell命令设置静态ip
- Android(安卓)程序获取、设置铃声、音量、静音、扬声器
- Android(安卓)8.1 设置中首选网络类型缺少LTE
- android 界面布局 很好的一篇总结
- Android实现系统下拉栏的消息提示——Notification