创建 textfield_default
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="Color Hash Code"
android:endColor="@color/background_material_light"
android:angle="90" />
</shape>
在drawable中创建edit_text.xml
<item
android:state_window_focused="false"
android:state_enabled="false"
android:drawable="@drawable/textfield_disabled" />
<item
android:state_pressed="true"
android:drawable="@drawable/textfield_pressed" />
<item
android:state_enabled="true"
android:state_focused="true"
android:drawable="@drawable/textfield_selected" />
<item
android:state_enabled="true"
android:drawable="@drawable/textfield_default" />
<item
android:state_focused="true"
android:drawable="@drawable/textfield_disabled_selected" />
<item
android:drawable="@drawable/textfield_disabled" />
</selector>
<EditText
style="@drawable/edit_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/materialDesignEditText"
android:ems="10"
android:hint="Text here"
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000"
android:textColorHint="@android:color/secondary_text_dark"
android:textSize="15dp" />