Android on-screen keyboard auto popping up
You can use the following line of code in the activity's onCreate method to make sure the keyboard only pops up when a user clicks into an EditText
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
How to remove auto focus/keyboard popup of a field when the screen shows up?
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editTextField.getWindowToken(), 0);
or
set activity property in manifest file as below in the application tag
android:windowSoftInputMode="stateHidden"
OnScreen keyboard opens automatically when Activity starts
Android opens the OnScreenKeyboard automatically if you have an EditText
focussed when the Activity starts.
You can prevent that by adding following into your Activity's onCreate
method.
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Automatic popping up keyboard on start Activity
Use this attributes in your layout tag in XML file:
android:focusable="true"
android:focusableInTouchMode="true"
As reported by other members in comments it doesn't works on ScrollView
therefore you need to add these attributes to the main child of ScrollView
.
How to prevent the keyboard from popping up on mobile devices?
When step up button is clicked, the input will be focus, so mobile device display keyboard, the solution is add readonly attribute, when user click input box, remove it, on blur, add readonly attribute again.
see the code snippet to understand
$( "#spinner" ).spinner();$( "#spinner" ).click(function(event){ $(this).removeAttr('readonly').select();});$( "#spinner" ).blur(function(event){ $(this).attr('readonly', 'readonly');});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js" integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E=" crossorigin="anonymous"></script><link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <input id="spinner" >
keyboard automatic pops up when moving from one activity to another
If you have tried everything that comes as an accepted ans according to your links for the ques, then why don't you try debugging your start activity, i mean on which you have put intent to start the respective activity.
While debugging one of my application i found that android soft keyboard has that problem of not going down even after finishing the activity that calls it, it stays on screen for few seconds but this doesn't happen frequently.
So i suggest you to debug your calling activity too just try putting "focusable=false" on the component from which you called the respective activity.
Android: How do I prevent the soft keyboard from pushing my view up?
You can simply switch your Activity's windowSoftInputMode
flag to adjustPan
in your AndroidMainfest.xml
file inside your activity tag.
Check the official documentation for more info.
<activity
...
android:windowSoftInputMode="adjustPan">
</activity>
If your container is not changing size, then you likely have the height set to "match parent". If possible, set the parent to "Wrap Content", or a constraint layout with constraingts to top and bottom of parent.
The parent container will shrink to fit the available space, so it is likely that your content should be inside of a scolling view to prevent (depending on the phone manufacturer and the layout choosen...)
- Content being smashed together
- Content hanging off the screen
- Content being inacccessable due to it being underneath the keyboard
even if the layout it is in is a relative or constraint layout, the content could exhibit problems 1-3.
Prevent the keyboard from displaying on activity start
I think the following may work
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
I've used it for this sort of thing before.
Related Topics
Populating Spinner Directly in the Layout Xml
How to Deal with Different Aspect Ratios in Libgdx
Where Is the All Android Broadcast Intent List
Android Opengl .Obj File Loader
What Is the Meaning of Android.Intent.Action.Main
How to Set Custom Typeface to Items in Navigationview
Android Sharedpreferences in Fragment
Debugging with Android Studio Stuck at "Waiting for Debugger" Forever
API to Automatically Upload APK to Google Play
Finding the Dominant Color of an Image in an Android @Drawable
Android Multiple Screen Sizes with Same Density
Custom Global Application Class Breaks with "Android.App.Application Cannot Be Cast To"
Cordova Platform Add Android Not Working While Listing Android Targets