Make linear layout scrollable when keyboard opens - android

There is a screen with a fixed header(AppBarLayout) and LinearLayout(with four TextView's and a Button at bottom). When keyboard is opened text field gets hidden. I want only linear layout to be scrollable. Have tried with ScrollView, adjustResize in manifest & i am not using
"Theme.Holo.Light.NoActionBar.Fullscreen"
Nothing worked out. How to achieve the same.

You can use the following code to push the layout up when keyboard is shown.
getActivity.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Related

Lock view inside layout when keyboard appear

I have an ImageView aligned on bottom of my layout contains "footer" of my app. Layout contains also ad EditText. Now when i tap on EditText and keyboard appear, it doesn't go over my footer, but footer get moved on above keyboard. There's a way to lock the imageView and get keyboard go over ImageView?
Add this in your activity tag in the manifest android:windowSoftInputMode="stateHidden|adjustPan"
Yes. Have a look at android:windowSoftInputMode manifest attribute. Specifically, consider using adjustPan there.

How to put Margin between Edittext and softkeyboard in full screen

I am using viewpager with full screen theme.
but facing a problem that my softkeyboard hides the button when edittext in focus.
want to put some margin between EditText and Softkeyboard.
Tried all the things but nothing worked.
Please help me.
How to add margin between EditText and Soft Keyboard?
this is the questions link which i've asked.
In the activity entry in your AndroidManifest try putting:
android:windowSoftInputMode:adjustPan, this means when the keyboard comes up it will adjust the view behind it to move up so it is not obscured by the keyboard.
In the EditText you can also try adding a paddingBottom to adjust the gap between the keyboard and the bottom of the EditText.
In my case I had a custom background for the EditText, which was no longer looking OK. Because the parent view for me was ConstraintLayout I added another View element behind the EditText with:
app:layout_constraintEnd_toEndOf="#id/view_chat_history_send_text"
app:layout_constraintStart_toStartOf="#id/view_chat_history_send_text"
app:layout_constraintTop_toTopOf="#id/view_chat_history_send_text"
android:layout_marginBottom="#dimen/margin_normal"
Note: here view_chat_history_send_text is the EditText. And then I added a layout_marginBottom of the same margin as the paddingBottom of the EditText.
This means, when the EditText grows the background view grows as well, but it still maintains the gap between the keyboard and the EditText bottom.
I applied above methods which worked for me was
Set android:windowSoftInputMode on the Activity to "adjustPan"
than I added the padding to the edittext with gravity bottom
and it works like charm.

AdjustResize with a custom EditText not working correctly

I have an EditText using a background with a big height, when I click on my EditText, the screen shifts up to show the soft keyboard, but not the entire EditText stays visible. The bottom part of the Edit Text background disappears because the soft keyboard goes up in it.
I need that my screen shifts up a little more! How could I do that?
Tks,
I think its better to use a ScrollView.
Using this will shift the entire screen up.
Try it out once
Create a empty layout and put it at the bottom of the screen by property align parent bottom set to true.
Now set your edittext above it. Add property layout_above and pass the id of the layout.
Now in the manifest, add screensize to config changes attribute for that activity or in the application tag

Android - ScrollView activity hosted in TabActivity and windowSoftInputMode

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.

Android FrameLayout and Softkeyboard Issue

I have a FrameLayout with a LinearLayout added to it with a gravity of bottom. As a result the LinearLayout appears at the bottom of the screen, and on top of all other layers. This is my required functionality. However when ever a softkeyboard appears on the screen, it pushes the bottom layout up. As a result that layout hides the fields that i am typing in. What can i do to avoid this ?
Kind Regards,
Add the following attribute to your related activity inside AndroidManifest.xml
android:windowSoftInputMode="adjustPan"

Categories

Resources