Android定制自己的EditText轻松改变底线颜色

2019-12-10 19:35:42王振洲

查看这篇文章:android利用xml实现分割线

edittext 去除边框

android:background="@null"

这个代码可以去掉 edittext 的边框
edittext 底部加线

在drawable 新建一个 line.xml

<shape xmlns:android="http://www.easck.com/apk/res/android"
android:shape="rectangle" >

 <solid android:color="@color/orange_normal" />

 <size
  android:height="1dp"
  android:width="1000dp" />

</shape>

在layout 的布局文件中引用

<EditText
  android:id="@+id/phone"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@null"
  android:drawableBottom="@drawable/line"
  android:hint="@string/phone_hint"
  android:inputType="phone"
  android:maxLength="11"
  android:maxLines="1" />

以上就是本文的全部内容,希望对大家的学习有所帮助。



注:相关教程知识阅读请移步到Android开发频道。