Push up content when clicking in edit text

Actually if you want your entire layout pan up than you should use :

SOFT_INPUT_ADJUST_PAN

meaning:

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

this will keep the keyboard closed and when opened it'll push your entire activity up.


This worked for me.

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE|WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

I faced a similar issue, the solution was simple.

If the theme in the activity is set as Fullscreen @android:style/Theme.Holo.NoActionBar.FullScreen, the keyboard was not pushing the contents up.

After I changed the activity to @android:style/Theme.Holo.NoActionBar, the keyboard is now pushing the activity contents up.


This can be used in Fragment Class to move the Edit text up and Scroll till end.

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

This will work for sure if your Fragment Activity theme is not in FullScreen.

Hope this will help!

Tags:

Android