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?
Related
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:
I have a TabActivity which has the tabs across the bottom of the screen. My first tab hosts an activity which consists of a fixed header layout at the top of the screen, and a ScrollView beneath it which contains several EditText controls. The ScrollView scrolls it's content fine between the header bar and the bottom tabs, the problem occurs when an EditText is tapped and the soft keyboard appears. I understand to control the behaviour of the views when the keyboard appears I need to use the windowSoftInputMode attribute in the manifest XML file. However I've tried both the following settings :
adjustResize - Gives the correct functionality for the ScrollView and the header layout remains fixed at the top of the screen. However the tab bar controls are pushed up on top of the keyboard.
adjustPan - The tab bar controls remain at the bottom of the screen beneath the keyboard (which is what I want) but the other views are pushed up by the keyboard meaning the header layout gets pushed up off the screen.
It seems I need characteristics of both settings, but they can't be used together. I've heard of the setting adjustNothing but if I try this my project fails to build as it doesn't recognise this setting. I guess I need my tab host activity to have adjustPan but my content activity to have adjustResize but it seems you can't combine the two as it's the tab host activity that takes precedence.
Any help greatly appreciated.
In the absence of any direct solution for this, I have resorted to a kind of hack. I have set my TabHost activity to adjustResize and then written code to hide/unhide the tab bar controls (TabWidget) when the soft keyboard appears/disappears. I managed to get a pretty good result in the end, using the technique here : Adjust layout when soft keyboard is on to detect the keyboard appearing/disappearing.
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.
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.
I have developed an iPhone app and now going to port it to Android. Almost all features work but the only thing I noticed is when I focus any Texbox or Textarea, the keyboard is opened and moves the whole page off the screen. I got to know that putting android:windowSoftInputMode="adjustPan" would solve the issue but then another issue came out.
Now when I focus any text element, the keyboard is opened but the view size is squeezed to the height (minus keyboard height) shifting bottom tab buttons above keyboard which is very bad effect in my opinion. Although it doesn't now move the whole page off the screen but can I use this property android:windowSoftInputMode="..." to ask it to show keyboard over tab buttons (hiding tab buttons under keyboard) but just move the view if the text elements are being hidden?