您的位置:首页 > 移动开发 > Android开发

Android实现EditText被点击,下划线不改变颜色

2017-04-13 00:13 295 查看

实现EditText点击,下划线不改变颜色

有时候我们希望输入框被选中的时候,下划线不改变成colorAccent,这怎么实现呢?看下面

其实可以这样实现,把EditText的下划线设置空,之后自己画上一条自定义的下划线,这样就能实现其功能了

代码:

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:background="@null"
android:id="@+id/password_text"
android:layout_width="match_parent"
android:layout_height="40dp"
/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignBottom="@id/password_text"
android:background="#EEEEEE"/>
</RelativeLayout>


android:background="@null"
设置下划线为null

view是添加的下划线
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: