我可以在android编辑文本字段中更改光标大小吗?

San*_*ndo 17 android

我想更改在Android EditText字段中闪烁的光标的宽度和颜色.那可能吗?

vin*_*3m1 25

RES /绘制/ cursor_red.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <size 
        android:width="5dip" />
    <solid
        android:color="@color/red" />
</shape>
Run Code Online (Sandbox Code Playgroud)

在您的EditText中:

android:textCursorDrawable="@drawable/cursor_red"
Run Code Online (Sandbox Code Playgroud)

注意:仅限API 12及以上