Search code examples
androidandroid-layoutandroid-edittextandroid-cursor

Set specific edittext has cursor blinking when enter the page


The problem is there is a edittext and I would like to set it default has a cursor on it (but not focus and hide the keyboard )

try

          android:textCursorDrawable="@null"
                android:cursorVisible="true"



               <EditText
                    android:id="@+id/comment"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_margin="1dp"
                    android:background="@drawable/comment"
                    android:hint="@string/cmt"
                    android:paddingLeft="5dp"
                    android:paddingRight="5dp"
                    android:textColor="#AAACAD"
                    android:textColorHint="#AAACAD"
                    android:textCursorDrawable="@null"
                    android:cursorVisible="true"
                    android:textSize="15sp" />

but not works. Please help. Thanks a lot


Solution

  • @user782104
    You can use this attribute android:windowSoftInputMode="stateHidden" in your AndroidManifest.xmlfile where you declare that Activity.

    so this way cursor will be in edittext but keyboard will not display.