suraj
suraj

Reputation: 71

Android softkeyboard messes up viewport height and never sets it back

I have a webpapp that require a sticky botton navigation bar that stays at the bottom of the screen. I had taken the easy way out to use

.nav_bar { 
    width: 100%
    position: fixed;
    bottom: 0;
}

This has worked for me for all the views in desktop as well as mobile browsers. I had to port it to a webapp and the whole thing seems to break down as soon as I had to pull up the android soft keyboard.

As soon as the soft keyboard in Android is brought up to enter the amount in the text box, it messes up the viewport size of the current and subsequent pages.

Before the keyboard, I checked window.innerHeight and it was 615 which matches the screen size of the phone. After the keyboard is invoked, it suddenly jumps to (644 to 1182 depending on the page length).

Appreciate any help.

Below is the screen grab of the issue.

Before bringing up the keyboard

After bringing up the keyboard

Upvotes: 2

Views: 281

Answers (1)

Adam Fręśko
Adam Fręśko

Reputation: 1064

Try working with soft input methods.

You are using them this way in mafifest file between tag

<activity android:name="ActivityA" android:windowSoftInputMode="adjustResize">

Upvotes: 1

Related Questions