Supress the Soft Keboard when an activity loads... yet again - android

this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Same problem that I've read on other posts. I don't want the soft keyboard to pop up when the Activity loads. The above code snippet works, however my View no longer scrolls up so that the User can still see the EditText.
It scrolls without this line of code. Any ideas?

Set right attribute on your activity in manifest
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

Related

Android: the soft keyboard is hiding the EditText in fragment

I have a fragment that has some EditTexts that need to be filled by the user. There's a problem that the soft keyboard hides the EditText so that the user cannot see what they're writing. I don't want the user to scroll manually, I want the fragment to adjust so that it fits the keyboard automatically.
IMPORTANT NOTE: I have seen lots of suggestions to add android:windowSoftInputMode="adjustResize"
or android:windowSoftInputMode="adjustPan"in manifest. However, I want this action to be only for a specific fragment and not for all fragments within the activity.
I have tried adding requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
In onCreateView or in onCreate but nothing seems to change.
In my case,
android:windowSoftInputMode="adjustPan" and ScrollView
it's work for Fragment in Activity.

Redrawing UI when keyboard closes

I have a ScrollView with few EditText fields.When tapped on editext field, keyboard appears,
But while closing the keybaord, the UI elements that were behind the keybaord are redrawn.
The UI elements that were behind the keyboard just disappears for a moment while the keyboard is closing and reappears again.
I can use adjustPan,adjustResize in manifest file, but this will move entire screen up. ( I have master details view with details view in scrollview ).So, I am not using it.
Can someone please let me know if there is any other approach to achieve this.
Thanks in advance.
Edit : i am using android 4.2.2
try this in your Activity tag inside Manifest file
android:windowSoftInputMode="stateAlwaysHidden|adjustPan"

Keyboard not showing on activity start: Android phones

I have an edittext in my activity, and on activity and on create view
I am setting the focus on the activity. while setting focus, I am also
trying to show the keyboard. It works on some devices, but on others it
just doesn't show.
I tried to step through the code and found that the view is not created, when
the show keyboard is called. Maybe that is the reason.
I am not sure what the problem is. Is there a way to make sure, that if a edit text
is in focus, the keyboard shows up on app start.
Thanks,
You can try to show the Soft Keyboard by calling the following line during onCreate:
getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
I hope that helps.
In your AndroidManifest.xml, add this attribute to the <activity> tag for the Activity you want the keyboard shown:
android:windowSoftInputMode="stateVisible"

Why does soft keyboard show up?

Is there any way to find out why the soft keyboard show up in one of my views ?
The app is quite big and it's not obvious why the keyboard gets enabled. Do you know any way to debug that?
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);
or
android:windowSoftInputMode="stateHidden"
In the manifest.

Android Keyboard automatically appears for EditText when activity is created

I have a single activity class and it has a two EditTexts on the screen. When the activity launches the keyboard launches with it. Why is this? I did not request enter anything yet into the edit box. Why does it do this? And how can I get rid of this behavior?
Try setting your stateHidden in the manifest file for the activity:
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
and this might be helpful:
How to keep soft keyboard from opening on activity launch in Android?

Categories

Resources