0

How to make the cursor automatically disappear from EditText when not writing ?

I want something easy to understand. I am not a much programming expert

<android.support.design.widget.TextInputEditText
                                android:id="@+id/name1"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="8dp"
                                android:ems="8"
                                android:fontFamily="@font/bahij_janna"
                                android:hint="@string/team_2"
                                android:lines="1"
                                android:textColor="?attr/textColor"
                                android:inputType="textCapWords"
                                />

enter image description here

See an example of the problem via the link

dan1st
  • 6,537
  • 6
  • 18
  • 44
  • check this https://stackoverflow.com/questions/5582702/disable-edittext-blinking-cursor and then this https://stackoverflow.com/questions/8063439/android-edittext-finished-typing-event – Elias Fazel Feb 17 '20 at 21:39
  • 3
    Does this answer your question? [Disable EditText blinking cursor](https://stackoverflow.com/questions/5582702/disable-edittext-blinking-cursor) – Elias Fazel Feb 17 '20 at 21:40
  • You can use either the xml attribute android:cursorVisible="false" or the java function setCursorVisible(false). – Sonali Bharati Feb 18 '20 at 10:03
  • No, this site did not answer my question, and there were no clear answers @EliasFazel – Abdulrahman Bin Rabbaa Feb 18 '20 at 13:09

2 Answers2

0

android:textCursorDrawable="@null"

you can set the cursor as null for hide the cursor till the click event occured. the cursor will shows up when you click the edittext to start typing.

cursor will always help us to copy and paste the text.

0

To remove the cursor from edittext you need to set

text.setFocusable(false);

text.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {

            text.setFocusableInTouchMode(true);
            return false;
        }

});