1、文字
layout布局:
<TextView
android:layout_width="@dimen/textview_button_width"
android:layout_height="match_parent"
android:text="@string/wifi_item_hulv"
android:textColor="@drawable/selector_upgrade_text_press"
android:textSize="@dimen/text_size_selected" />
selector_upgrade_text_press xml文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="@color/text_pressed_blue" android:state_pressed="true" /><item
android:color="@color/switch_general_track_check_color"/>
</selector>
2、svg图片
layout布局:
<ImageView android:id="@+id/iv_bt_loading_down"
android:layout_width="@dimen/wifi_signal_height"
android:layout_height="@dimen/wifi_signal_height"
android:background="@drawable/ic_icon_general_update_72" />
svg图片:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="72dp"
android:height="72dp"
android:viewportWidth="72"
android:viewportHeight="72">
<path
android:pathData="M0.5,0.5h71v71h-71z"
android:strokeAlpha="0"
android:strokeWidth="1"
android:fillColor="#D8D8D8"
android:strokeColor="#979797"
android:fillType="evenOdd"
android:fillAlpha="0"/>
<path android:pathData="M21,34.5C21.8284,34.5 22.5,35.1716 22.5,36C22.5,
43.4558 28.5442,49.5 36,49.5C39.6279,49.5 43.0248,48.0644 45.5407"
android:strokeWidth="1"
android:fillColor="@color/selector_upgrade_ic_press"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</vector>
在res目录下新建一个color目录,然后在这个color目录下新建一个selector_upgrade_ic_press xml文件
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/ic_state_pressed" android:state_pressed="true" />
<item android:color="@color/ic_state_not_pressed"/>
</selector>
3、文字按钮
layout布局:
<TextView
android:id="@+id/btn_pincode_cancel"
style="@style/ConfirmButtonNew"
android:paddingStart="@dimen/confirm_btn_padding_start"
android:paddingTop="@dimen/confirm_btn_padding_top"
android:background="@drawable/round_blue_bg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="@string/cancel"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape>
<corners android:radius="@dimen/round_bg_radius" />
<solid android:color="@color/round_blue_bg_color"/>
</shape>
</item>
<item android:state_pressed="true">
<shape>
<corners android:radius="@dimen/round_bg_radius" />
<solid android:color="@color/round_blue_bg_color_press"/>
</shape>
</item>
</selector>