Home » Android » Is there a way to set android:windowSoftInputMode by Fragment?

Is there a way to set android:windowSoftInputMode by Fragment?

Posted by: admin June 15, 2020 Leave a comment

Questions:

android:windowSoftInputMode is set normally set on an Activity but I set everything up as one Activity that switches to different Fragments to support tabbing and I need different soft input mode for fragments.

My actual problem is that adjustPan causes text views within webviews to get covered by the keyboard and adjustResize was resizing a view that I was using for calculations and I thought setting different soft input mode for each fragment would be a good workaround.

How to&Answers:

try this each onCreateView of your fragment

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

i hope its works for you and reply