EditText无法显示跳动的游标

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/One_Month/article/details/79267494

最近项目,登录界面输入发现EditText控件输入时候没有游标,找到一个解决方法,记录一下

在Xml文件中设置EditText属性
android:cursorVisible=”true”
android:textCursorDrawable=”@drawable/cursor_drawable”

cursor_drawable是一个shape文件,定制了游标的颜色样式,shape文件

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">

    <size android:width="1dp" />
    <!--填充色就是游标的颜色-->
    <solid android:color="@color/tv_bottom_blue" />
</shape>

猜你喜欢

转载自blog.csdn.net/One_Month/article/details/79267494
今日推荐