在drawable中写cursor_shap.xml文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#000000" />
<size android:width="1dp"/>
</shape>
在想设置的EditText添加属性
android:textCursorDrawable="@drawable/cursor_shape"
本文介绍如何通过XML文件自定义Android应用中EditText组件的文本光标形状和颜色。通过创建一个名为cursor_shape.xml的文件,并在其中定义光标的样式,然后将此样式应用到所需的EditText上。
3万+

被折叠的 条评论
为什么被折叠?



