解決方法有以下3種
1、在Edittext中加入以下屬性
android:cursorVisible="true"android:textCursorDrawable="@null"
2、在Edittext中加入以下屬性
android:cursorVisible="true"android:textCursorDrawable="@drawable/test_cursor"對應的drawable文件 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <size android:width="1dp" /> <span style="font-family: Arial, Helvetica, sans-serif;"> <!-- 光標寬度可以自己定義 --></span> <solid android:color="#008000" /> <!-- 光標顏色可以自己定義 --> </shape>
3、如果以上沒有效果就請用這個
明確指定EditText的inputType屬性值inputType屬性中的textCapSentences
不要用這個,國內手機好像沒有用到這個,個人證實而已,用text或者textMultiLine
android:inputType="text|textMultiLine"
以上這篇解決EditText不顯示光標的三種方法(總結)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。
新聞熱點
疑難解答