Android 如何在EditText中使用框光标?

Android 如何在EditText中使用框光标?,android,android-edittext,Android,Android Edittext,我在Android 9.0上开发了类似控制台的应用程序。 我想在EditText中使用框形光标。有没有办法改变光标的形状 我想更改光标形状,如下所示: 如何更改光标形状?您可以在编辑文本中使用android:textCursorDrawable=“@drawable/mycursor”,创建如下形状: mycursor.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http:/

我在Android 9.0上开发了类似控制台的应用程序。
我想在EditText中使用框形光标。有没有办法改变光标的形状

我想更改光标形状,如下所示:


如何更改光标形状?

您可以在编辑文本中使用android:textCursorDrawable=“@drawable/mycursor”,创建如下形状:

mycursor.xml:

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