Closing keyboard leaves white portion in Fragment which are in ViewPager - android

I am using fragments in my application which are in Viewpager. There is Scrollview in all of the fragments containing many views. When user click on Edittext, keyboard opens but when user click done button on keyboard then keyboard get hidden leaving black screen. I tried a lot my self but no luck. Please guide me..
Have tried almost all the possibilities of configChanges and windowSoftInputMode in manifest file of my activity like,
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:windowSoftInputMode="stateHidden|adjustPan"
And if i load that fragment without viewpager than its working perfectly fine. The issue is with viewpager and fragments with scroll.With keyboard

Related

Android: the soft keyboard is hiding the EditText in fragment

I have a fragment that has some EditTexts that need to be filled by the user. There's a problem that the soft keyboard hides the EditText so that the user cannot see what they're writing. I don't want the user to scroll manually, I want the fragment to adjust so that it fits the keyboard automatically.
IMPORTANT NOTE: I have seen lots of suggestions to add android:windowSoftInputMode="adjustResize"
or android:windowSoftInputMode="adjustPan"in manifest. However, I want this action to be only for a specific fragment and not for all fragments within the activity.
I have tried adding requireActivity().window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
In onCreateView or in onCreate but nothing seems to change.
In my case,
android:windowSoftInputMode="adjustPan" and ScrollView
it's work for Fragment in Activity.

Different WindowSoftInputMode for activity and fragment

I want to achieve the functionality shown in the image. Let me explain the scenario in details.
I have a main activity and several fragments. what I want is when the keyboard is open the activity will remain same (will not resize) but the fragment will change its height and will be shown above the keyboard.
I have tried to do this using android:windowSoftInputMode="adjustResize" and android:windowSoftInputMode="adjustPan" for activity and getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); in onCreateView of the fragment. But its not working properly. I am getting this.
is there any way to solve this?

Fragment 2 pane windowSoftInputMode for soft keyboard

I am facing issues when soft keyboard opens up on my 2 pane layout as seen above.
For the left side list view fragment i want to adjustPan the soft input. If i don't do this then when the soft keyboard closes it leaves back blank space on the list fragment.
For the right side detail pane i want to adjestResize the soft input so that user can enter text into both edit texts and click button with soft keyboard still open.
I tried setting the properties differently for my fragments in their respective onCreateView() using setSoftInputMode() but that did not help me much because both fragments got adjustResize finally.
Any solutions/ideas which will help me with this?
Thanks in advance.
to ensure that the system resizes your layout to the available
space—which ensures that all of your layout content is accessible
(even though it probably requires scrolling)—use "adjustResize":
<application ... >
<activity
android:windowSoftInputMode="adjustResize" ... >
...
</activity>
...
Please go through this tutorial

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.

Rendering bugs when SoftKeyboard closes

I have the following problem:
I have a FrameLayout with a main Fragment, which is always shown, and some overlay "extra" fragments which are shown or not, depending on the state of the application. (This Layout is used on tablets)
Now, if the user initiates a dialog with an EditText, this causes the SoftKeyboard to appear.
The Dialog and the Keyboard(No matter which type of dialog, I tried AlertDialog and DialogFragment) overlays the other Fragments.
So far, so good.
But when the dialog is finished and the keyboard closes, my whole application is pushed a bit up and down in an animation, and then there are several rendering bug in the ActionBar and at the bottom edges of my fragments.
This happens only if the keyboard overlaid exactly one of my "extra" fragments. (If it overlays two fragments, then everything is good).
Anyone an idea how to get rid of this?
Configuring android:windowSoftInputMode does not help.
You can adjust your keyboard in fragment using
getActivity().getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

Categories

Resources