安卓的EditText控件中,系统默认的光标颜色是灰色,很不美观,这时就需要对这个cursor进行样式的进行修改。
修改光标的颜色及粗细方法如下:
1、在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="#3399dd"/>
</shape>
2、为EditText添加属性:android:textCursorDrawable="@drawable/cursor"