其他分享
首页 > 其他分享> > Android TextView settextcolor selected

Android TextView settextcolor selected

作者:互联网

文件color_select_3aa5f0_333333

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

    <item android:color="@color/color_3AA5F0" android:state_selected="true"/>
    <item android:color="@color/color_333333" android:state_selected="false"/>
    <item android:color="@color/color_333333" />
</selector>




<TextView
        android:id="@+id/tv_woman"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dp_46"
        android:text="女"
        android:gravity="center"
        android:textSize="@dimen/sp_16"
        android:textStyle="bold"
        app:layout_constraintTop_toBottomOf="@+id/tv_man"
        android:layout_marginTop="@dimen/dp_20"
        android:textColor="@color/color_select_3aa5f0_333333"
        android:background="@drawable/bg_select_f7f7f7_ffffff"
        />

注意 ,在res下新建color 文件夹,并且selector 里的selected  item必须要为第一个,不能讲最后一个item 放在第一位

标签:color,selected,item,select,333333,Android,settextcolor
来源: https://blog.csdn.net/qq_26331411/article/details/113989207