Is there a way to control where the soft keyboard appears on the screen? Assuming it takes the whole width, I would like to be able to specify a height so that the keyboard shows on the top half of the screen. Is this possible?
Currently I'm just showing the keyboard using SoftInputMode in the manifest file.
android:windowSoftInputMode="stateVisible"
Please try using android:windowSoftInputMode="stateAlwaysHidden" attribute and also apply this attribute in the previous activity of current activity in which the keyboard is opened.
Related
I have android:windowSoftInputMode="adjustPan" for my Activity in the AndroidManifest and want to show the keyboard programmatically after adding an EditText to a Fragment in my Activity. Whatever method I try to show the keyboard, it ignores the "adjustPan" setting and resizes my layout.
How can I programmatically show the keyboard while respecting the "adjustPan" setting?
2 years late, but if someone else got the same problem.
Use:
android:windowSoftInputMode="stateVisible|adjustPan"
In the layout file of one of my activities I've got 2 inputs at the top and at the bottom and a next button.
The problem is, when keyboard shows, it covers the button. How can I bring the views above keyboard?
Check this blog post On-screen Input Methods
You can use android:windowSoftInputMode attribute to specify what should happen whether the layout is resized or whether it scrolls.
In your manifest file
<activity name=".YourActivity"
android:windowSoftInputMode="stateVisible|adjustResize">
...
</activity>
Related questions:
Move layouts up when soft keyboard is shown?
Push up content when clicking in edit text
Android: How do I prevent the soft keyboard from pushing my view up?
How to move the layout up when the soft keyboard is shown android
How to check visibility of software keyboard in Android?
Just put in manifest..
Use "adjustResize"
It makes main window always resized to make room for the soft keyboard on screen.
<application
......
>
<activity
.............................
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
</application>
I'm building a simple app for android that's taking input from the user via an EditText. But when the EditText is focused and the on screen keyboard appears it causes the whole layout to move a few dps so that the action bar slides under the statusbar. How can i fix the activity so that it doesn't move when the keyboard opens?
Tried this which made it better but it still moves a few dps
View dv=getWindow().getDecorView();
dv.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
Try using adjustResize as your activity's android:windowSoftInputMode. Add the following line in your manifest in that particular activity.
<activity android:windowSoftInputMode="adjustResize">
Also, check the other options available for windowsSoftInputMode.
I have a relative layout that is supposed to move up when the soft keyboard opens. It worked all fine until I had to make the application full screen. After I set
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen"
the layout doesn't move up. It stays where it is and the keyboard is on top of it.
I tried with android:windowSoftInputMode="adjustPan|adjustResize" but it doesn't work.
I found my answer. The answer to this question can be found here:
Android How to adjust layout in Full Screen Mode when softkeyboard is visible
I'm trying to have an AutoCompleteTextView widget in the bottom of my screen, but of course the autocomplete options are not shown because of the keyboard ...
Any tips ? Perhaps it's possible to the the suggestions box opened upwards ?
(used Android's tutorial to check it)
Please add this to your activity in the manifest :
android:windowSoftInputMode="stateHidden|adjustResize"
The activity's main window is always resized to make room for the soft keyboard on screen
or
android:windowSoftInputMode="stateHidden|adjustPan"
he activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing
Depending on what suits your needs