Marcus Persson
Marcus Persson

Reputation: 383

Android - when keyboard is displayed; hide one layout-view and screen-fit another. How?

I've been trying some different combinations with adjustPan and adjustResize, and different layout types as main container... Nothing worked so far.

In the main container I got my two key views A and B. Currently; A is basically an EditText wrapped in a ScrollView. B is a LinearLayout (it's containing an audio player).

B is supposed to be locked to the bottom of the screen. A should fill the rest of the screen. This is easily done with either LinearLayout or RelativeLayout using gravity: bottom or allignParent: bottom.

However, when the EditText is focused the keyboard pops up. When this happens B should be hidden or hidden-underneath the keyboard while A fills up the remaining space of the screen.

The image below is a visual description of what I'm explaining above:

Visual description

Below is an image of the normal screen:

App normal screen

The layout belongs to a Fragment. The fragments Activity contains a ToolBar that is placed on the top of the screen. When I used adjustPan the ToolBar was moved above the screen.

Any ideas how to solve this? Thank you!

Upvotes: 0

Views: 558

Answers (1)

Avinash Joshi
Avinash Joshi

Reputation: 1308

use android:windowSoftInputMode="adjustNothing"

Upvotes: 0

Related Questions