Android - ScrollView activity hosted in TabActivity and windowSoftInputMode - android

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.

Related

Trying not to show the buttons showing when I click in one of the EditText of the form

I'm working on an Android app with Android Studio. I have a form with several field and 2 buttons at the bottom to either validate or going back. The problem is that as soon as I click in one of the EditText of the form, the 2 buttons are following the keyboard.
How to prevent these 2 buttons to show up and force them to stay at the bottom of the page, hidden behind the keyboard. The form is in a ScrollView, which is in a ConstraintLayout. I tried many things like having my 2 buttons in the ConstraintLayout. Also outside in a RelativeLayout with constraint at the bottom of the parent... I also tried to use LinearLayout instead of the ConstraintLayout and weight each component but the buttons are still there. The only way I found is to use a vertical LinearLayout without weighting the components. But then I have the problem of not seeing the buttons if the screen is too small. I would like buttons to stay at the bottom.
Is it normal? Do I have to fix it from the code by hiding the buttons when focusing on one of the TextEdit, or by the layouts?
The other thing is that if I click on the last field ("Ville"), the form doesn't move and I still see the first 2 lines...
Thanks a lot for your help
On your manifest.xml you can set android:windowSoftInputMode to adjustPan.
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustPan" />
From Android documentation:
Don't resize the window to make room for the soft input area; instead
pan the contents of the window as focus moves inside of it so that the
user can see what they are typing. This is generally less desireable
than panning because the user may need to close the input area to get
at and interact with parts of the window

How to arrange the layout when Soft Keyboard opens up in android

I have searched for various answers for this particular problem but could not find one. I am developing an android application and I am currently up to arranging the layouts.
My problem is when a soft keyboard opens up in a form containing lots of input fields, the buttons at the bottom also keeps coming up. What I want is the buttons should not come up and along with this the form should be scrollable to bottom of the layout while the soft keyboard is still visible.
Before I was trying lots of modes combinations for windowSoftInputMode inside AndroidManifest.xml in the respective activity, but could not get any satisfactory result.
Screenshots:
The normal form (shown the bottom part) looks like this:
When the soft keyboard opens up, it cuts the lower portion i.e. I am unable to scroll the layout further.
I somehow managed to remove the buttons using following code, I do not know whether this is correct or not:
<activity
android:name=".usermanagement.SignUp"
android:label="साइन अप"
android:windowSoftInputMode="stateVisible|adjustPan" />
Now I am wondering whether I can scroll to the bottom of the layout while keeping the soft keyboard active and not showing the buttons(Home button and Next button)

Android soft keyboard hides edit text field with windowSoftInputMode set

Some of my activities are made up of 3 fragments in a vertical layout (Top, middle and bottom)
The middle fragment is the only one that is wrapped in a scrollview. The top and bottom fragments are static. The bottom fragment has the edit text controls for user input. Weighting for fragments from top to bottom are .1, .6 and .3
When the soft keyboard comes up for user input, it covers the edit text fields the user needs to enter text in. It seems that the fragments move up, but not enough and half of the bottom fragment is covered by the keyboard. I used multiple switches with the windowSoftInputMode attribute and none seem to work.
windowSoftInputMode="adjustResize|stateHidden"
windowSoftInputMode="adjustPan"
How can I guarantee that at least the bottom fragment is completely visible when the soft keyboard is displayed? What do I have to do?
I got this working fully with XML. If you are looking to:
Not have the soft keyboard come up when an activity starts
Not have the soft keyboard hide any editText on the page (even with fragments)
Enter the following in your AndroidManifest.xml file for the activity that you wish to do the above to.
android:windowSoftInputMode="stateHidden|adjustPan"
You should add this to your manifist.xml file.
android:windowSoftInputMode="adjustResize"

Layout resize on keyboard open in fullscreen mode only

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...

Keyboard layout hiding android action bar?

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.

Categories

Resources