Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.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 布局中只有第一个按钮使用状态选择器_Android - Fatal编程技术网

Android 布局中只有第一个按钮使用状态选择器

Android 布局中只有第一个按钮使用状态选择器,android,Android,为什么这个布局中只有第一个按钮使用我定义的选择器 我没有包括选择器,它有各种样式和绘图,因为第一个按钮工作正常,所以我假设问题不在于选择器 onClickListeners可以在所有按钮上正常工作 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:backgrou

为什么这个布局中只有第一个按钮使用我定义的选择器

我没有包括选择器,它有各种样式和绘图,因为第一个按钮工作正常,所以我假设问题不在于选择器

onClickListener
s可以在所有按钮上正常工作

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:background="#ffffff"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <LinearLayout
            android:id="@+id/copyLabel"
            android:background="@color/backgroundblue"
            android:orientation="vertical"
            android:paddingTop="8dp"
            android:paddingBottom="8dp"
            android:layout_height="wrap_content"
            android:layout_width="match_parent">

        <TextView
                android:textColor="#ffffff"
                android:layout_marginLeft="10dp"
                android:text="@string/copy"
                android:textSize="22sp"
                android:textStyle="bold"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

        <TextView
                android:layout_marginLeft="10dp"
                android:textColor="#ffffff"
                android:text="Notepad &amp; system"
                android:textSize="16sp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

    </LinearLayout>

    <Button
            android:id="@+id/SNS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:text="Single"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <View
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/lightgray"/>

    <Button
            android:id="@+id/DNS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:background="#ffffff"
            android:text="Dual"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <View
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/lightgray"/>

    <Button
            android:id="@+id/TNS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:background="#ffffff"
            android:text="Table"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <LinearLayout
            android:id="@+id/sysLabel"
            android:background="@color/backgroundblue"
            android:orientation="vertical"
            android:paddingBottom="8dp"
            android:layout_height="wrap_content"
            android:layout_width="match_parent">

        <TextView
                android:layout_marginTop="5dp"
                android:layout_marginLeft="10dp"
                android:textColor="#ffffff"
                android:text="@string/copy"
                android:textSize="22sp"
                android:textStyle="bold"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>

        <TextView
                android:id="@+id/ssLabel"
                android:layout_marginLeft="10dp"
                android:textColor="#ffffff"
                android:text="System"
                android:textSize="16sp"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"/>

    </LinearLayout>

    <Button
            android:id="@+id/SS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:background="#ffffff"
            android:text="Single"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <View
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/lightgray"/>


    <Button
            android:id="@+id/DS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:background="#ffffff"
            android:text="Dual"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <View
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/lightgray"/>


    <Button
            android:id="@+id/TS"
            style="@style/button"
            android:drawableLeft="@drawable/sc_cut"
            android:drawablePadding="10dp"
            android:background="#ffffff"
            android:text="Table"
            android:textSize="20sp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:gravity="left|center_vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>

    <View
            android:layout_marginBottom="5dp"
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@color/lightgray"/>

</LinearLayout>

您正在为其他按钮指定背景色。这可能会覆盖样式中指定的背景可绘制内容。

Wow。我怎么会错过呢?(可能是因为编码会话进行了15个小时:))。非常感谢。