In my fragment I have an editText inside a scrollview and when I click on that I set it to open like this:
getActivity().getWindow().setSoftInputMode(WindowM
What about setting RESIZE instead of PAN? You will be able to keep your EditText above the SoftKeyboard. Try as follows:
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
However, instead of doing this at runtime, you can set it in the manifest as an Activity (parent) attribute. This will also be handled in your fragment (child):
Then, as you can see, the EditText is above the SoftKeyboard, but from your layout, you have a TextView with android:layout_alignParentBottom="true" attribute which will overlap the EditText:
To prevent this behaviour, just set the ScrollView above the last TextView as follows:
And you will get the following result: