Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to keep the toolbar visible with adjustPan?

I have a layout like the one below and I would like to have the following behavior when the user taps on the EditText:

  1. Keyboard should overlay the "LinearLayout aligned to the bottom";
  2. EditText should be visible on the screen, not overlaid by the keyboard;
  3. The toolbar should be visible on the screen;

My layout

enter image description here

Expected behaviour

enter image description here

Actual result with windowSoftInputMode = adjustPan

Requirements not met:

  1. Toolbar should be visible on screen;

enter image description here

Actual result with windowSoftInputMode = adjustResize

Requirements not met:

  1. Keyboard should overlay the "LinearLayout aligned to the bottom";

enter image description here

Actual result with windowSoftInputMode = adjustNothing

Requirements not met:

  1. EditText should be visible on screen, not overlaid by the keyboard;

enter image description here

Has anyone faced the same issue and achieved the requirements?

like image 512
Gustavo Avatar asked Mar 04 '16 12:03

Gustavo


1 Answers

I am not sure that there is any out of box solution to make it works as you expect.

However, you can achieve the specified behavior by using windowSoftInputMode = adjustNothing and setting focus listener to edit text, and scroll the scroll view, when edit text gets focus.

If it is not clear how to implement scrolling I can add an example.

like image 130
Rostyslav Roshak Avatar answered Sep 21 '22 01:09

Rostyslav Roshak