Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android NumberPicker without blinking cursor

I'm using the NumberPicker under the Android SDK level 13 inside a fragment. Works fine, but each time the activity is started the cursor is blinking behind the number. How can I get rid of the blinking cursor, I don't know why this widget has the focus. This is the xml of the NumberPicker:

<NumberPicker android:id="@+id/timer_picker_hrs"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
like image 567
hoffimar Avatar asked Aug 26 '11 17:08

hoffimar


2 Answers

I get this solution from somewhere but I don't remember from where. This works good for me, just do this in your activity.

myNumberPicker.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);

You can also set this in XML:

android:descendantFocusability="blocksDescendants"

(Borzh comment)

like image 100
Bilal Rabbani Avatar answered Nov 15 '22 15:11

Bilal Rabbani


One way of removing the blinking cursor is disabling the soft keyboard for the NumberPicker. (refer to: Disable soft keyboard on NumberPicker )

like image 39
damaxxed Avatar answered Nov 15 '22 17:11

damaxxed