Android EditText cursor control, color modification, show and hide

Modify the Android EditText cursor color:

QQ group: 372135639

EditText has one property: android:textCursorDrawable This property is used to control the color of the cursor

android:textCursorDrawable= ”@The function of “null” and “@ null” is to make the cursor color the same as text color

Android set EditText cursor color and thickness:

In the Android input box, if you want to change the color and thickness of the cursor, you can do it in the following two steps:

1. Create a new cursor control color in the resource file drawable_ cursor.xml

<?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="#008000"  />  
</shape>  

Set the EditText cursor to show/hide

android:cursorVisible= ”True “//displays
the android:cursorVisible= ”False “//hide

Note: default display

//The cursor displays the problem by default. It will not be displayed by default on Meizu mx6. (it is better to control the display and hiding of cursor by code)

Read More: