创建主题
该主题可以更改文字下方拖拽手柄的颜色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="RedTextCursor">
<item name="android:colorControlActivated">#FF0000</item>
</style>
</resources>
应用主题到Dialog/PopupWindow/DialogFragment/Activity
根据组件类型,使用对应的主题设置方式
class MyDialog : Dialog(context, R.style.RedTextCursor)
创建光标资源
用于改变光标颜色和形状
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size android:width="@dimen/dp_2" />
<solid android:color="@color/primary_200" />
</shape>
设置TextView光标
<TextView
android:textCursorDrawable="@drawable/shape_cursor_red"/>
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 【Android】设置光标颜色和图标
发表评论 取消回复