I have only one EditText
in my Activity and I want it to hide the blinking cursor once the input is done - either the focus is switched or user presses Done - in other words, as the input keyboard disappears.
Here's the code for the EditText
.
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:id="@+id/editText"
android:textColor="@color/theme2"
android:textSize="15dp"
android:singleLine="true"
android:maxLines="1"
android:background="@android:color/transparent"
android:imeOptions="actionDone"
android:nextFocusUp="@id/editText"
android:nextFocusLeft="@id/editText"/>
How do I change my blinking cursor to normal? You are correct, just hit the insert key on your keyboard and the flashing will immediately stop.
How do I remove the cursor from Edit text? You can use either the xml attribute android:cursorVisible="false" or programatically: java: view. setCursorVisible(false)Below also opens keyboard when EditText is clicked, and hides it when you press done in the keyboard.
“setCursorVisible(false)” This method hides the cursor in the Edit Text when the application launches.
To stop the cursor from blinking in an EditText
, simply use this line:
editText.setCursorVisible(false);
That's it.
I would simply
editText.clearFocus();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With