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?
Related
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
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.
i have a registration screen (which is a relative layout having multiple EditText and a Button) and i simply want my View to move up and down smoothly with click on each EditText so none of the EditText stay hidden behind the Keyboard.
At the moment the Bottom Editview is hiding behind the keyboard.
I tried 'adjustResize' but rather than moving the whole view up/down, its only moving the bottom Button up/down.
Screen1:
Screen After "adjustResize"
Just add
android:windowSoftInputMode="adjustResize" is manifest file.
Also put your layout in the ScrollView so you can scroll your layout while the keyboard is on.
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.
I have an activity where the view is like a form, where user can enter the details and At the bottom there are two buttons "save" and "cancel". The form has many number of edit boxes.
So I have taken a relative layout and put all these edit boxes in it and then put the relative layout inside scroll view. I have taken another relative layout to add "Save" and "cancel" button.
Finally I have put the scroll view and relative layout(which has buttons) in another relative layout which is the main view of my activity.
My problem is , when I click any of the edit box, keyboard will come up and it hides the buttons(Save and Cancel).
I want to make the buttons to display above the keyboard(When the keyboard is on) like in the edit contact activity of "Contacts" Application .
I am using android:windowSoftInputMode="adjustPan|adjustResize" for my activity but of no use.
I have gone through so many stack overflow questions regarding this but I am not able to achieve this.
How can I do this with my code?
in Edit Contact activity save button is added to layout in bottom, and outside of scroll view.
What you can do, to make your save and cancel button visible all the time, wheather, soft keyboard is visible, or not. Make parent layout a relativelayout, in this layout add two views one scroll view, and other relativelayout having buttons. Let Relative Layout properties layout_width=fill_parent and layout_height=wrap_content, and align_parent_bottom=true, and scroll view's layout_width=fill_parent, layout_height=fill_parent, lavout_above=#+id/rlButtons, in ScrollView, add a RelativeLayout having all the editTexts.
I got the solution .
My parent layout is Relative Layout . In this layout I added a Scroll View and a relative layout. In the scroll view I added a relative layout which is having all edit texts. In relative layout I added save and cancel buttons. I set the scroll view weight = 1.
For my activity I set android:windowSoftInputMode="adjustResize".