问题的复现:
Activity布局文件代码如下:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:clickable="true"
android:layout_centerInParent="true"
android:layout_width="100dp"
android:layout_height="54dp"
android:background="@drawable/color_bg_selector">
<TextView
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp" android:textColor="@color/bg_color_text_selector"
android:text="确定"/>
</RelativeLayout>
</RelativeLayout>
就一个 按钮View,背景可改变, TextView 的字体颜色也可改变
color_bg_selector.