废话不多说,先上图,然后上代码,徐某的文章就是这么的直入主题
1.在drawable目录下创建一个shape,color指定光标的颜色即可

代码:
<?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/colorPrimary"/>
</shape>
2.设置EditTextView的android:textCursorDrawable属性
代码:
android:textCursorDrawable="@drawable/input_textcursor_color"

效果图

有问题可以在下方评论,我看到会第一时间回复你,这就是我,话不多说的徐某人,徐某人不谈原理,只助你CV
网友评论