Keyboard pop ups at landscape change orientation - android

When device is rotated from portrait to landscape, keyboard keeps popping up. This happens without being any EditText on the screen. I tested with several devices and it happens only on Samsung devices. Is there a way to prevent keyboard pop ups?

You can use the following 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);
Tested.

Are you tried this one in your manifest fileandroid:configChanges="orientation|keyboardHidden"

Add to root element android:focusableInTouchMode="true" attribute.

Related

Soft keyboard changes the view layout when it opens in landscape

Why does the soft keyboard change the layout so dramatically when I swap this screen to landscape? It works perfectly fine in portrait. I am assuming that it has to do with the limited space, but the keyboard could still open without covering the EditText that spawned it. It even inserts a Search button. Is there a way to prevent this from happening?
This is default Android behavior, users should be used to it. But if you really don't want this to happen, you can put android:imeOptions="flagNoExtractUi" in the EditText layout.
Also, the "Search" button is what you've specified in the android:imeOptions for the action.

Soft keyboard shrinks activity

I am writing custom soft keyboard. The problem is, that on Motorola Moto G it shrinks activity. This happens on any text input.
For some reason, this does not happen on another android, HTC One. What I am missing?
Some notepad withoud keyboard, notepad with my keyboard.
When I click on a button, everything become OK for a moment, that's why I took a shot of a screen phone instead of taking a screenshot.
In your AndroidManifest.xml file, look for your activity and try adding
android:windowSoftInputMode="adjustPan"

Retain soft-input/IME state on Orientation change

I'm having a small user experience issue in my app;
When changing from landscape to portrait (or portrait to landscape) with the Soft Keyboard open, the keyboard hides.
What I want to do is to stop the keyboard hiding on orientation change.
(Edit - I don't want to force the keyboard open, if the keyboard was hidden before the orientation change, I want it to stay hidden - I want to retain the keyboards open/closed state).
I've looked around for an answer and it seems adding stateUnchanged to the windowSoftInputMode options in the manifest for the Activity is the correct way to solve this (as described in the android documentation:
android:windowSoftInputMode="stateUnchanged|adjustResize"
The problem is this seems to have absolutely no effect.
Does anybody know of any caveats to this functionality? Does it perhaps not work if the EditText which is focused is in a Fragment?
Add this to your code and it will work :
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

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"

keyboard disappears while orientation change to landscape mode

I am enabling orientation change in focusChangeListener of an edittext in my app.
It is working fine, but the issue is if the user flips the keyboard to landscape mode keyboard disappears.
It will come up only if user tap on edittext again or change orientation to portrait mode.
I need to display keyboard in landscape mode without touching the edittext.
Please help me.
Generally, its a bad idea to mess with the default IME behavior because there are devices out there with hardware keyboards.
Now, that you have been warned, listen for the orientation change and if the keyboard was visible before the change and there is no hardware keyboard on the device, show the keyboard manually.
Try using android:configChanges="orientation" into your manifest class.
<activity
android:name=".classname"
android:configChanges="keyboardHidden|orientation"
>
if works then accept it.

Categories

Resources