EditText Medittext = (EditText) Findviewbyid (r.id.et); Medittext.setfocusable (true); Medittext.setfocusableintouchmode (true);
Display cursor
Medittext.requestfocus (); // get focus Cursor appears
Monitor EditText focus Change hasfocus True when focus is acquired
Medittext.setonfocuschangelistener (new Android.view.View.OnFocusChangeListener () { @Override Public void Onfocuschange (View V, boolean hasfocus) { if (hasfocus) { // get focus else { // lose Focus }}} );
Code that controls the cursor using an XML configuration file
In cursorvisible
True to display
False to hide the cursor
android:cursorvisible="true"android:cursorvisible="false "
EditText does not automatically get the focus set on the parent control of the EditText
android:focusable="true"android:focusableintouchmode=" true "
android:textcursordrawable="#ff2244"
If you want to set the cursor color and font settings @null can be
Android Edittext display cursor gets focus listening focus