Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android RelativeLayout可绘制选择器不';行不通_Android_Android Relativelayout - Fatal编程技术网

Android RelativeLayout可绘制选择器不';行不通

Android RelativeLayout可绘制选择器不';行不通,android,android-relativelayout,Android,Android Relativelayout,我很难在单击时绘制我的相对动画更改背景。我使它可点击和聚焦,但这并没有改变。背景保持静止,以实现可绘制。提前谢谢 <RelativeLayout android:id="@+id/bttn_type_rl" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity

我很难在单击时绘制我的相对动画更改背景。我使它可点击和聚焦,但这并没有改变。背景保持静止,以实现可绘制。提前谢谢

<RelativeLayout
            android:id="@+id/bttn_type_rl"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:background="@drawable/day_bttn_bg_red"
            android:clickable="true"
            android:focusable="true"
            android:paddingLeft="5dp"
            android:paddingRight="5dp" >

            <ImageView
                android:id="@+id/bttn_type_iv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="5dp"
                android:contentDescription="@string/app_name"
                android:src="@drawable/relationship" />

            <TextView
                android:id="@+id/bttn_type_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/bttn_type_iv"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="1dp"
                android:text="@string/type_bttn_txt"
                android:textSize="@dimen/data_fill_bttn_txt_size"
                android:textStyle="bold" />
        </RelativeLayout>

以下是drawable中的选择器xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/bttn_red_p_bg" android:state_enabled="false" android:state_pressed="true"></item>
    <item android:drawable="@drawable/bttn_red_a_bg" android:state_enabled="true"></item>

</selector>


好吧,似乎我通过从选择器xml中删除这一部分使事情得以顺利进行:
android:state\u enabled=“true”
这也帮助了我!非常感谢。