Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.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 是否显示以设置文本在SwitchCompat处于关闭状态时可见?_Android_Switchcompat - Fatal编程技术网

Android 是否显示以设置文本在SwitchCompat处于关闭状态时可见?

Android 是否显示以设置文本在SwitchCompat处于关闭状态时可见?,android,switchcompat,Android,Switchcompat,目前,我的SwitchCompat看起来像下图(顶部),但是我需要在关闭状态下显示可见文本 我将如何实现这一点 您使用的是背景图像吗?如果需要,您需要在图像上设置文本而不是打开开关。 <android.support.v7.widget.SwitchCompat android:id="@+id/autoLocation" android:layout_width="match_parent" android:layout_height

目前,我的
SwitchCompat
看起来像下图(顶部),但是我需要在关闭状态下显示可见文本

我将如何实现这一点



您使用的是背景图像吗?如果需要,您需要在图像上设置文本而不是打开开关。


  <android.support.v7.widget.SwitchCompat
        android:id="@+id/autoLocation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@color/colorPrimary"
        android:checked="false"
        android:paddingBottom="10dp"
        android:paddingLeft="20dp"
        android:paddingRight="20dp"
        android:paddingTop="10dp"
        android:text="@string/autoLocation"
        android:textColor="#ffffff"
        android:textOff="Off"
        android:textOn="On"
        android:textSize="20sp"
        app:showText="true" />

我不会在图像上使用它,因为我以后需要本地化应用程序