Linerlayout background selector无效解决方法

来源:互联网 发布:淘宝交易数据 编辑:程序博客网 时间:2024/05/21 07:58

Linerlayout xml属性:

    <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:background="@drawable/bg_white_to_gray"        android:orientation="horizontal">

selector xml属性:

    <?xml version="1.0" encoding="utf-8"?>    <selector xmlns:android="http://schemas.android.com/apk/res/android">        <item android:drawable="@color/colorAccent" android:state_pressed="true"/>        <item android:drawable="@color/colorPrimary"/>    </selector>

发现并没有什么卵用

需要在Linerlayout xml属性加上一句

    android:clickable="true"
0 0
原创粉丝点击