1.自定义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" />
<solid android:color="@color/color_login_btn_bg_normal" />
</shape>
2.设置android:textCursorDrawable
<EditText
android:id="@+id/login_username_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:hint="用户名称"
android:inputType="text"
android:maxLength="25"
android:singleLine="true"
android:textCursorDrawable="@drawable/shape_login_color_cursor"
android:textSize="16sp" />
设置好效果: