1.在res/drawable文件夹下新建一个Xml文件,文件名为my_cursor.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#FFFFFF" />
<size android:width="2dp"/>
</shape>
2.在Layout文件的EditText控件标签里加入
android:textCursorDrawable="@drawable/my_cursor"
本文介绍如何在Android应用中创建并使用自定义光标。通过新建XML文件my_cursor.xml来定义光标的样式,并在Layout文件中将此光标应用于EditText控件中。
929

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



