在 res/drawable 新建光标样式文件 my_cursor.xml

<shape android:shape="rectangle"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <size android:width="2dp" />
    <solid android:color="@color/black"/>
</shape>

如果只是修改单个edittext的光标样式,在edittext里添加

android:textCursorDrawable="@drawable/my_cursor"

如果是全局修改

<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        ...
        <item name="android:textCursorDrawable">@drawable/my_cursor</item>
        ...
</style>

 

相关文章:

  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-07-09
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案