Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i change the Cursor size in android edit text field?

Tags:

android

I want to change the width and color of the cursor that blinks in an Android EditText field. Is that possible?

like image 906
Sando Avatar asked Jun 03 '11 10:06

Sando


People also ask

How do I change the height of my cursor?

Open the Mouse pointer window by navigating to Windows Start Menu > PC Settings > Ease of Access > Mouse pointer. You can change your pointer size by dragging the slider under Change pointer size. Choose a pointer size from 1 to 15, where 1 is the default size.

How do you change the color of your cursor on Android?

Setting the android:textCursorDrawable attribute to @null should result in the use of android:textColor as the cursor color.


1 Answers

res/drawable/cursor_red.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <size 
        android:width="5dip" />
    <solid
        android:color="@color/red" />
</shape>

in your EditText:

android:textCursorDrawable="@drawable/cursor_red"

note: only API 12 and above

like image 111
vinc3m1 Avatar answered Sep 17 '22 18:09

vinc3m1