See full input layout on bottom when opening virtual keyboard - android

In my overall LinearLayout I have an input area (also wrapped in a linear layout) which is at the very bottom of the layout. I want the user to see the full input area (not only the EditText element, but also the wrapping linear layout).
For this I have added
android:windowSoftInputMode="adjustPan"
to my AndroidManifest file. Which works great, but I do not see the whole linear layout at the bottom, it's half-way truncated. I do see the EditText at least half, so that the blinking cursor is fully visible.
What can I do so that I see the whole bottom layout?

Keyboard will be moved/aligned with the item that is focused (your input EditText element). Make sure that height of your EditText is the same as your wrapping LinearLayout. If you use LinearLayout to add some padding you can switch to EditText that have margin on top/bottom instead.

Related

Android: How to make the soft keyboard appear over a view when the adjustResize property is enabled

Currently, I'm trying to develop a screen where there are two views in a linear layout in a vertical orientation. The top view is a relative layout containing edit text view along with other views. When the keyboard is opened to type in the edit text, the expected behaviour is the keyboard should be drawn on top of the bottom view, but it should resize the top view.
But currently when I try to do this having set android:windowSoftInputMode="adjustResize|stateHidden", the bottom view is also being resized and pushed on top of the keyboard.
How can I achieve the intended behaviour

Center the layout after hiding the Android button programmatically

I have one LinearLayout and it is center_horizontal.
It contains three buttons: left, middle and right. All were fixed in same row.
When I hide the right button programmatically it will hide the button, but not center the left and middle buttons.
I want the left and middle buttons to be centered in the layout when I am hiding the right button. Is this possible?
Making a view invisible, makes it only invisible which has its effect.
Try using gone instead of invisible and you are done!
Do the following settings:
1) Set visibitlity to gone
2) Set the width of ALL elements to 0dp and the weight of ALL to 1
Make sure that your three buttons are placed in LinearLayout with the orientation of horizontal, now use this code in Java file:
rightbutton.setVisibility(View.GONE);
Try this,
yourbutton.setVisibility(View.GONE);
What it does is, it stops the button from occupying any space on your screen which will in turn allow the other buttons to shift.
Just keeping it invisible will just hide the button from view, but it will still occupy the space and not allow the other buttons to adjust

Android soft keyboard hides edit text decorator

Layout MockI have a decorated (Framed) EditText which I use in my app. When the soft keyboard comes up it hides the part of the frame that is below the text view. For the frame functionality I use a LinearLayout which contains the EditText.
Is there a way to set the keyboard not to hide the bottom part of the frame(The containing Layout)?
Edit: I guess I am not explaining myself properly. The Linear layout containing the EditText is not the main fragment layout, it is contained in it and is used as a decorator for it. what I am basically trying to do is set a margin between the keyboard and the EditText so that the keyboard doesn't hide the surrounding LinearLayout which is again, not the main layout for the fragment.
In the mock, the problem is that the keyboard goes up all the way to the bottom of the EditText and covers the bottom part of the wrapper layout. I need the entire wrapper layout to be seen. Any Ideas.
You have to wrap your linear layout within ScrollView with the following property android:fillViewport="true" and in manifest write down the following line of code `android:windowSoftInputMode="adjustResize".
Set all your Activity view or layout in ScrollView.
Which will make your view scrollup when soft keyboard open and it don't hide your view.

prevent only 1 view from coming up when keyboard is up

there are 2 views which are set to "align parent bottom" as true in my activity. One is a textview and other one is a linear layout. I want to display this linear layout only when keyboard is up, that too on the top of keyboard. The issue is like when i tap on the edittext, keyboard is up with linear layout on top that.But the textview is also coming up. I dont want that textview to come up.I just want that linear layout to come up when keyboard shows. Is it possible?then how?

overlapping layouts one above the other

I have an edit text whose height I am setting as wrap_content.
I have some layout below the edit text.
when ever i write data in it and press enter to go to new line because of wrap content the size of edit text increases and its height increases downwards.Also the layout below is pushed down.
I want the layout below not to be pushed down but the edit text should overlap the layout below. Can this be done?
If you want overlapping layouts you need to use something like a RelativeLayout, if you were to only use a LinearLayout all the layouts will be placed in order.
If you use a Relative Layout you could define that all the TextViews start in the top left but the second one could have a margin so it is offset from the top. Then when your top textbox expands it would overlap the other (assuming the first TextView is drawn afterward , to do this list it in the XML after the other)

Categories

Resources