The EditText cursor is visible on Android 4.0 or a lower version, but in the Android 5.0 (Lollipop) version it is not showing. How can I fix this?
            Asked
            
        
        
            Active
            
        
            Viewed 1,223 times
        
    1
            
            
        - 
                    Maybe your cursor has the same colour as background? You can change your cursor's colour to something other that background colour and check. – questioner May 21 '15 at 13:03
- 
                    Could you please post your xml here – Hitesh Singh May 21 '15 at 13:07
- 
                    I've solved this problem to do like this [link](http://stackoverflow.com/questions/15527420/custom-cursor-color-in-searchview). – Rooney May 22 '15 at 01:33
2 Answers
1
            
            
        Add android:cursorVisible="true"and android:focusableInTouchMode="true" in your XML file.
Example:
<EditText 
    android:id="@+id/textLabel"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:cursorVisible="true" 
    android:focusableInTouchMode="true"/>
Sometimes EditText requires focus to show the cursor so maybe it will help you.
 
    
    
        Peter Mortensen
        
- 30,738
- 21
- 105
- 131
 
    
    
        Eric Brandwein
        
- 861
- 8
- 23
1
            
            
        I've solved this problem to do it like this link.
The problem is that I was using it like this:
<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:maxLength="50"
    android:textColor="#666666"
    android:textCursorDrawable="#666666"/>
If you are going to use textCursorDrawable, you should use drawable res to the value like this:
android:textCursorDrawable="@drawable/red_cursor"
 
    
    
        Peter Mortensen
        
- 30,738
- 21
- 105
- 131
 
    
    
        Rooney
        
- 1,195
- 10
- 18