###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" >