I'd been trying to maintain consistency in layout whether keyboard is open or not. These issue is generated in FULLSCREEN Mode (hiding top notification bar) only. It works like a charm without Fullscreen.
Tried:
Added android:softWindowMode="adjustResize" and android:softWindowMode="adjustPan"inside <activity> of Manifest File.
Added android:isScrollableContainer="false" inside by top layout with blue background having first, next,prev,last symbol.
Desired Layout:
Top Layout Blue Background should never get hide whether keyboard is open or not.
These issue get resolved with ActionBar but it requires a lot of turn work which I don't intent to.
.
Is there any way other than ActionBar which resolve my issue?
Try to create a fixed header layout for the blue back ground layout, and below this blue layout create a layout for other fields inside the ScrollView ...so that when keyboard appeared it will not hide the header blue layout...
Related
When the soft keyboard shows up, I only want the Views inside the most outer layout to be pushed up. The reason is because the most outer layout has a background which gets squished when the keyboard shows up. I want the background to be unaffected.
How do I do this?
I had the same issue when developing a chat app. What worked for me was setting the background on the window and not in the layout. Like this:
getActivity().getWindow().setBackgroundDrawableResource(R.drawable.background_hd);
Have you tried setting the following:
android:windowSoftInputMode="adjustResize"
in the <activity../> tag in AndroidManifest?
This should adjust the size of your layout in this activity when the keyboard is displayed.
There are plenty of more implementations you can use to handle different states RE the documentation:
http://developer.android.com/guide/topics/manifest/activity-element.html
I wonder and not getting how facebook manages to fit the layout on all screen sizes by removing the padding or margins as shown below in landscape mode and open keyboard mode.
If anyone has implemented the same or getting the logic behind it please let me know.
If you place the elements inside a ScrollView, they will automatically move up when the keyboard is open. You must also have android:windowSoftInputMode="adjustResize" in your AndroidManifest.xml file for the appropriate Activity.
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.
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