7
I have a screen with a EditText
ai whenever I enter it already opens the keyboard. I wanted you to only open the keyboard when I clicked on it.
I tried that but the keyboard is not opening at all:
mItemDescriptionTextView.setFocusable(false);
7
I have a screen with a EditText
ai whenever I enter it already opens the keyboard. I wanted you to only open the keyboard when I clicked on it.
I tried that but the keyboard is not opening at all:
mItemDescriptionTextView.setFocusable(false);
10
You need to add android:windowSoftInputMode="stateHidden"
within your AndroidManifest.xml
:
<activity
android:name=".SuaActivity"
android:windowSoftInputMode="stateHidden"/>
This flag will hide the keyboard when the user enters your Activity
(even if the EditText
have focus).
2
To resolve this problem open the Androidmanifest.xml file, then in your Activity statement add the following line:
android:configChanges="keyboardHidden|orientation|screenSize"
What will make the keyboard not appear when Activity is created is the keyboardHidden
.
Example:
<activity
android:name="com.example.activity.MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:label="@string/app_name" >
</activity>
1
I put these two attributes in Contraintlayout and also work
android:focusable="true"
android:focusableInTouchMode="true"
1
You can also create a method to hide the keyboard when you want, for example:
public void hideKeyboard(View v) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
0
Use these attributes in XML:
android:focusable="true"
android:focusableInTouchMode="true"
0
Use these attributes in your XML where this Edittext is, I could only use putting these attributes inside a Linearlayout as below:
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true" />
Browser other questions tagged android
You are not signed in. Login or sign up in order to post.