how to maintain space between edittext and keyboard in viewpager fragments - android

I am using view pager and i have edit text in my third fragment but when i focused on edit text the soft keyboard hides the edit text but if i types multiple lines and deletes them then keyboard does not hides the edit text.
I am using edit text inside Relative layout but keyboard overlaps the relative layout and hides the edit text.
I want that keyboard should not hide the relative layout
or
If we can place some space between edit text and Keyboard
I've tried Bottom Margin, android:windowSoftInputMode found many of the solution for individual activity but they did not work in full screen view pager

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

How to hide soft keyboard from fragment

I have a fragment with multiple linear layouts and one edit text box. However the keyboard stays open all the time. I've tried setting the fragment main layout as clickable and focusableInTouchMode which works but only for parts of the view that show the main layout. Any other parts of the view that are touched still do not hide the keyboard.
Does anyone know how I can overcome this without adding focus listeners to all parts of the layout?
Have you tried to set:
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

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?

Adjust the layout when the soft keyboard is on in android

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

Categories

Resources