布局使用selector不变色问题
16lz
2021-01-23
在工作的时候想给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:largeHeap属性
- Android:实现一种浮动选择菜单的效果
- Android中ImageButton自定义按钮的按下效果的代码实现方法,附网上
- Android TextInputLayout 使用及其属性
- Android控件Editext、TextView属性详解
- android ListView几个比较特别的属性
- android 图片切换,仿百叶窗效果