Wednesday, February 20, 2019

EditText

To show Edittext immediately when open new screen, add this line in AndroidManifest.xml
android:windowSoftInputMode="stateAlwaysVisible"
Otherwise, to prevent Edittext show, change to
android:windowSoftInputMode="stateAlwaysHidden"

To show number phone keyboard, add this line below setContentView.
e.setRawInputType(Configuration.KEYBOARD_QWERTY);

Press Ctrl+Shift+O  to clear red mark errors.
To show text hint inside Edittext, add this line in xml

android:hint="Text to show"
To set max character user can type in EditText, for example 30 characters, add this line.
 android:max="30"

No comments:

Post a Comment