Android EditView input box modify the default color of the cursor

Foreword

All know that the native Android controls color in your eyes sting, so there will be changes in the actual development, so today we look at the input to change the default color box cursor.
Create a file called cursor_style.xml style in drawble below

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size android:width="1dp" />
    <solid android:color="#4A90E2" />
</shape>

Then you can use the layout file

			<EditText
                android:id="@+id/ed_pwd"
         		android:textCursorDrawable="@drawable/cursor_style"
                android:textColor="#000"
                android:textSize="@dimen/sp_24"
                android:paddingLeft="@dimen/dp_15"
                android:layout_width="wrap_content"
                android:layout_height="@dimen/dp_65"/>

Then you can see the blue cursor.

Published 33 original articles · won praise 7 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_38436214/article/details/104778733