Skip to content

Instantly share code, notes, and snippets.

@beilly
Created May 9, 2018 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beilly/47768cdd9537a55525e74a411166ac36 to your computer and use it in GitHub Desktop.
Save beilly/47768cdd9537a55525e74a411166ac36 to your computer and use it in GitHub Desktop.
Android TextView修改光标
<?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="#ff6a45" />
</shape>
@beilly
Copy link
Author

beilly commented May 9, 2018

然后再基础主题样式中添加

<item name="android:textCursorDrawable">@drawable/edit_cursor_color</item>

或者在使用EditText的地方

android:textCursorDrawable=”@drawable/edit_cursor_color”

@beilly
Copy link
Author

beilly commented May 9, 2018

android:textCursorDrawable=”@null” 表示光标的颜色和字体的颜色一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment