###Android EditText 不显示光标解决方案###
####1. EditText使用的是图片背景 ####
如果是EditText使用的是图片背景会遮住光标
通过对EditText设置属性 android:textCursorDrawable="@null" 一般可以解决这个问题。
===>这个是安卓属性源码对这条属性的解释
<!-- Reference to a drawable that will be drawn under the insertion cursor. -->
<attr name="textCursorDrawable" format="reference" />
<!-- 上面的 format="reference" 的意思是: 参考某一资源ID。-->
<EditText
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:background = "@drawable/资源ID"
/>
<!-- 颜色样式根据传入的资源来定 -->
这个属性是通过设置EditText光标的颜色或者图片来重新生成一个自定义属性
的光标
####2. EditText使用的是shape背景 ####
对于自定义EditText使用的如果是Shape图形的话出错比较少,首先要保证中间透 明,如果还没有解决问题的话,就还有一个很大的可能就是你设置背景边框的时候没有对你的EditText 设置 padding 值,被覆盖了。
// padding 值很重要
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp" >
###Android EditText 自定义光标,修改样式###
这个其实比较简单通过设置android:textCursorDrawable="@drawable/资源ID"
来使用其它颜色或者图片样式
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textCursorDrawable="@drawable/ic_launcher"
android:paddingLeft="5dp"
android:paddingRight="5dp" >