editext点击后底下线条变色
留存用到了直接C+V 舒服了
<EditText
android:id="@+id/edit_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@drawable/et_underline_selector"
android:gravity="center_vertical"
android:hint="请输入手机号"
android:inputType="number"
android:maxLength="11"
android:paddingLeft="@dimen/_5dp"
android:paddingTop="@dimen/_10dp"
android:paddingBottom="@dimen/_10dp"
android:textColor="@color/c_999999"
android:textColorHint="@color/c_D7D7D7"
android:textSize="@dimen/text_size13" />
select文件
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false" android:drawable="@drawable/et_underline_unselected"/>
<item android:state_focused="true" android:drawable="@drawable/et_underline_selected"/>
</selector>
shape文件
变色前
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="0dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape>
<solid android:color="@android:color/transparent" />
<stroke
android:width="0.5dp"
android:color="@color/c_F1EFF0" />
<padding android:bottom="4dp" />
</shape>
</item>
</layer-list>
变色后
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="0dp"
android:left="-2dp"
android:right="-2dp"
android:top="-2dp">
<shape>
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@color/c_FF6B0F" />
<padding android:bottom="4dp" />
</shape>
</item>
</layer-list>
网友评论