1

I have a form accidents.

How I can scroll to bottom, when I use keyboard ?

Normally when I use activity I put android:windowSoftInputMode="adjustResize".

But now I'm using fragments, and I can't define in my manifest, searching for internet I found :

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

But it's not Working.

Related posts:

android making layout scrollable when soft keyboard open, but not shifting it upwards

Page scroll when soft keyboard poped up

Community
  • 1
  • 1
Calimbero
  • 21
  • 1
  • 4

2 Answers2

4

try by putting this:

android:windowSoftInputMode="adjustResize"

in manifest's activity code in which you are creating fragment.

All fragments of one Activity have the same behaviour as their parent Activity, but if you need different keyboard behaviour for different Fragments, you could dynamically change this property from your Fragment code like this:

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.softInputMode.SOFT_INPUT_ADJUST_PAN);
Parsania Hardik
  • 4,325
  • 1
  • 29
  • 33
0

Have a look to this library :

and do something like that :

@Override
    public void onKeyboardShown(int keyboardSize) {
        Log.d("KEYBOARD", String.valueOf(keyboardSize));
        scrollView.scrollTo(0,keyboardSize);
    }
Aditya Vyas-Lakhan
  • 12,393
  • 15
  • 55
  • 92
user1796260
  • 247
  • 1
  • 4
  • 18