Custom EditText cursor and edittext
Custom EditText cursor
- Set background android: background = "@ null"
- Set the cursor style: android: textCursorDrawable = "@ drawable/edit_cursor_line"
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:width="2dp" /> <solid android:color="@color/zhiRiRed" /> </shape>
- Remove or set the dot style under the cursor: android: textSelectHandle = "@ drawable/edit_select_handle" to remove the subscript. You can set the following parameters (android: textSelectHandle = "@ null" RUN error directly)
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <size android:width="0dp" /> </shape>
The overall code is as follows:
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@null" android:textCursorDrawable="@drawable/edit_cursor_line" android:textSelectHandle="@drawable/edit_select_handle" />