I have a view that has a ScrollView as root layout that has a background set.
When the keyboard pops up, I want the ScrollView to shrink so that it stays above the keyboard, but I want the background image to stay the same. It currently shrinks with the view.
I know I need to use adjustResize to keep the ScrollView on top and I can switch to adjustNothing to get the ScrollView behind the keyboard, but that way I would have EditTexts behind the keyboard.
Any idea/help is welcome!
Basically, I want the adjustResize behavior with the background acting as in adjustNothing.
Here are some screenshots:
Related
I have some EditTexts(about 6-8) in one activity, so I have to use Scroll layout.
But I find that scroll layout doesn't work well with windowSoftInputMode=“adjustPan”. And there's a flash at the inputmethod's area when inputmethod hides.
How would I scroll layout with windowSoftInputMode=“adjustPan”?
I changed windowSoftInputMode=“adjustPan” to windowSoftInputMode=“adjustResize”, but when I press the "back" button to hide inputmethod, it works very slowly and the inputmethod's background does not fit my app's theme.
Any ideas why might be wrong?
I have Login Activity with a background image and a frame layout.
The framelayout will be replaced by a relative layout which contains three edit text boxes in the relative layout and a button at relative layout's bottom i.e., alignParentBottom = true.
When I focus on any of the edit text boxes the keypad raises ans I want all of them to move accordingly and the button at bottom should be immediately above the keypad so I am using adjustResize in my manifest, but this is making my background image to get resized i.e., compressed and displaying it within the visible space of the screen.
I need my background image not to move while all other components should be moving according to the screen.
If I use adjustPan the button which is aligned at parent bottom is not getting placed above the keypad and is invisible behind the softpad.
Please help me in this regard if anyone knows the way to resolve this requirement.
Thanks.
Try adding android:windowSoftInputMode="stateVisible|adjustPan" to your activity in the manifest file.
Explained here:
adjustPan
The 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. This is generally less desirable
than resizing, because the user may need to close the soft keyboard to
get at and interact with obscured parts of the window.
If it's top layer just instead of setting that layer background you set that activity custom theme with that background. That way it does't resize. At least that worked for me.
Currently, when an EditText comes into focus and the keyboard comes up, the keyboard covers the form layout for a second, then the layout container resizes to expose the form, as illustrated below.
I'd like the layout to resize smoothly as the keyboard rises up. Is this possible?
Add this in your in the manifest:
android:windowSoftInputMode="adjustResize|stateVisible"
In my Android application running in a XOOM device, when I click in an Edittext the keyboard opens and hides the Actionbar. I don't want this to happen, how can I solve this? This is done by the Google Contacts app for the tablet for example.
EDIT:
I have several edittexts in which the user needs fo fill. At first, when the user clicked on one edittext on the bottom, the keyboard showed up and hide the edittext in which the user was typing, so he couldn't see what he was typing. I found it really bad, and to solve it I just added to the manifest: android:windowSoftInputMode="stateVisible|adjustPan"
But after that, now the screen adjust itselfs and hides the action bar.
The Google Contacts app does the same, but it magically doesn't hide the Action bar. How do they do it?
Use adjustResize instead of adjustPan. The framework will always try to keep the focused element on-screen by scrolling any parent views if necessary.
If your EditText field is not nested in some sort of scrolling container such as a ScrollView then your layout may be too tall to completely display when the keyboard resizes your activity. Try wrapping your form's layout in a ScrollView. This will also allow your app's content to scroll if it is running on a smaller screen device where it may have similar issues.
whenever I click on the EditText, the screen readjusts and the edittext-view moves up. But this is not enough and the soft-keyboard still covers the view to not show what a user typing.
My layout is as follows:
A listview occupying 65% of screen height, followed by an editetxt view and a button
LISTVIEW
______________________________
EDITTEXT |BUTTON
______________________________
My activity has the following flag set android:windowSoftInputMode="stateAlwaysHidden|adjustPan"
adjustPan forces the soft keyboard to appear on top of your layout, blocking anything at the bottom. You're going to want to use adjust resize instead, which will move up your EditText and Button, and shrink the ListView. If, in landscape mode, the ListView is shrunk to the point of being unusable/pointless, consider using a fullscreen IME keyboard.
Read about something like that just recently. Is this what you are looking for?
http://www.vogella.de/blog/2010/10/25/android-windowsoftinputmode/