Does anyone know how to disable the blinking cursor in an EditText
view?
You can use either the xml attribute android:cursorVisible="false"
or the java function setCursorVisible(false)
.
Change focus to another view (ex: Any textview or Linearlayout in the XML) using
android:focusableInTouchMode="true"
android:focusable="true"
set addTextChangedListener to edittext in Activity.
and then on aftertextchanged of Edittext put edittext.clearFocus()
;
This will enable the cursor when keyboard is open and disable when keyboard is closed.
You can use following code for enabling and disabling edit text cursor by programmatically.
To Enable cursor
editText.requestFocus();
editText.setCursorVisible(true);
To Disable cursor
editText.setCursorVisible(false);
Using XML enable disable cursor
android:cursorVisible="false/true"
android:focusable="false/true"
To make edit_text Selectable to (copy/cut/paste/select/select all)
editText.setTextIsSelectable(true);
To focus on touch mode write following lines in XML
android:focusableInTouchMode="true"
android:clickable="true"
android:focusable="true"
programmatically
editText.requestFocusFromTouch();
To clear focus on touch mode
editText.clearFocus()
If you want to ignore the Edittext
from the starting of activity, android:focusable
and android:focusableInTouchMode
will help you inshallah.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout7" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true" android:focusableInTouchMode="true">
This
LinearLayout
with yourEdittext
.