1、隐藏android中EditText自带的的下划线
android:background="@null"
或android:background="@/drawable/bg_edittext_norma.xml"
bg_edittext_norma.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--商品描述的可编辑框-->
<solid android:color="#FFFFFF" />
<corners android:radius="10dip"/>
<stroke
android:width="1dip"
android:color="#BDC7D8" />
</shape>
<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="输入用户名"
android:paddingBottom="5dip"
android:paddingTop="5dip" />
2、多行EditText的时候会出现光标在中间的问题:
关键代码
android:gravity="left"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="5"
android:background="#ffffff"
android:paddingLeft="5dp"
android:gravity="left" />
像这种。这是什么原因造成的呢?用来EdittText默认是gravity是center.就是从中间对齐。我们把他改成left啊top啊就OK了。
3、修改EditText的光标颜色
在使用EditText的XML 文件中加入一个属性:
android:textCursorDrawable="@null"
//或者
android:textCursorDrawable = "#fff000"
这个属性是用来控制光标颜色的,"@null" 是作用是让光标颜色和text color一样,当然也可以修改成你自己的颜色。