Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using "adjustPan" or "adjustResize" specific to a fragment

I'm wondering if it's possible to specify programatically or in the xml a way to use a windowSoftInputMode specific to a Fragment.

Let's say I have just one activity that contains two fragment, one fragment should use adjustPan and the other one adjustResize. How should I manage this?

Thanks!

like image 271
Jaythaking Avatar asked Oct 06 '16 18:10

Jaythaking


1 Answers

You can change the behavior programmatically, see this answer for that.

So what I would do: if fragment A is resumed, use getActivity() to get a reference to its parent activity, and then use the command from the question to change the behavior.

Then do the same with fragment B, but use the other parameter when setting the soft input mode behavior.

  • adjustResize would be: WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
  • adjustPan would be: WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN
like image 53
Daniel Zolnai Avatar answered Oct 21 '22 00:10

Daniel Zolnai