使用时EditText时光标不显示如何解决

这期内容当中小编将会给大家带来有关使用时EditText时光标不显示如何解决,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

解决方法有以下3种

1、在Edittext中加入以下属性

android:cursorVisible="true"
android:textCursorDrawable="@null"

2、在Edittext中加入以下属性

android:cursorVisible="true"
android:textCursorDrawable="@drawable/test_cursor"

对应的drawable文件

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

    <size android:width="1dp" />

    <span >
 
 <!-- 光标宽度可以自己定义 --></span>

    <solid android:color="#008000" />
 
 <!-- 光标颜色可以自己定义 -->
  </shape>

3、如果以上没有效果就请用这个

明确指定EditText的inputType属性值inputType属性中的textCapSentences

不要用这个,国内手机好像没有用到这个,个人证实而已,用text或者textMultiLine

android:inputType="text|textMultiLine"

上述就是小编为大家分享的使用时EditText时光标不显示如何解决了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。