1、布局文件
<Edittext android:id="@+id/et_username" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginStart="10dp" android:background="@null" android:gravity="center_vertical" android:textCursorDrawable="@drawable/edt_text_cursor_drawable" android:hint="@string/login_number_hint" android:text="200002" android:textColor="@color/loginGreenColor" android:textColorHint="@color/loginGreenColor" android:textSize="25sp" app:xml="@xml/qwerty"/>2、自定义光标样式drawable
在drawable里面新建资源文件shape
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:width="2dp" /> <!--设置editText的光标颜色--> <solid android:color="@color/loginGreenColor" /> </shape>3、引用自定义的光标资源文件
android:textCursorDrawable="@drawable/edt_text_cursor_drawable"
4、background属性设置不需要默认的背景
android:background="@null"