Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.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_Button_Textcolor - Fatal编程技术网

Android 所选按钮的文本颜色

Android 所选按钮的文本颜色,android,button,textcolor,Android,Button,Textcolor,我有一个这样的按钮: <Button android:id="@+id/button" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:text="Button" android:textC

我有一个这样的按钮:

<Button
        android:id="@+id/button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:text="Button"
        android:textColor="@color/my_gray" />

按下按钮后,文本颜色变为深灰色,这是已按下的颜色。我如何防止这种情况?在按钮上按I do button.settextcolor.color.my_gray;重置颜色,但无效。

尝试使用其他类型的按钮。或者可能适合您,因为您可以更轻松地控制他们的背景/图像


但是,最好的方法可能是使用类似于显示的选择器。

在按下按钮后,您是否在UI线程中执行某种繁重的操作,从而阻止其返回正常状态?我只是在按下按钮时将视图设置为可见。奇怪,按钮仍然处于按下状态?我不确定它是否处于按下状态。这似乎是一个“你已经推我”的状态,比如一个链接在被点击后如何变成不同的颜色。我想我基本上是在尝试复制一个复合按钮,但有点不同,所以我会将其标记为正确。