Android keyboard overlay - TNS 4.1.3



Keyboard overlays the inputs on Android.

The issue can be reproduced easily.

  1. I created the project using “Angular Drawer Navigation Template” from:

  2. Then I updated “settings.components.html” as per below:

<TextField id=“customer-lastname” [(ngModel)]=“customer.lastname” class=“input”> <TextField [(ngModel)]=“customer.firstname” class=“input”> <TextField [(ngModel)]=“” keyboardType=“phone” class=“input”> <TextField [(ngModel)]=“” keyboardType=“email” autocorrect=“false” autocapitalizationType=“none” class=“input”> <TextField id=“customer-lastname” [(ngModel)]=“customer.lastname” class=“input”> <TextField [(ngModel)]=“customer.firstname” class=“input”> <TextView [(ngModel)]=“customer.notes” maxLength=“130” borderWidth=“1” returnKeyType=“send” class=“input input-border”>

I tried to update “AndroidManifest.xml” with "android:windowSoftInputMode=“adjustResize”, but nothing changed!!!

This seems to be a nativescript bug:

Any suggestion or work-aroud?


You will have to set fitsSystemWindows to true for adjustResize to work.

eg: sideDrawer.nativeView.setFitsSystemWindows(true);

But doing so may affect appearance of your drawer. There are few more flags / options to be set depending on the Android version in order to fix that. An easy alternative could be using adjustPan.


You can do that application-wide by changing the windowSoftInputMode in your AndroidManifest

<activity android:name="com.tns.NativeScriptActivity"
   THIS LINE  >>> android:windowSoftInputMode="adjustResize" <<<<


android:windowSoftInputMode=“adjustResize” >>> doesn’t work :frowning:

sideDrawer.nativeView.setFitsSystemWindows(true); >>> works, but it affects appareance of the drawer (the toolbar is pushed down and a little rectangle appears on top - see below screen)



That’s exactly what I mentioned earlier.


Any way to remove that rectangle or limit this effect? … I cannot use adjustPan, as this causes another side effect :frowning:


adjustResize seems to work well in Playground app, I will try to find some time to debug and let you know.


adjustResize seems to work if set as soon activity is created, can you try adding this to your main.ts (before the bootstrapModule statement) and see if that makes any difference.

import * as app from 'application';
import { isAndroid } from 'platform';

declare var android;

if (isAndroid) {, (event: app.AndroidActivityEventData) => {


I tried but it doesn’t work :frowning:


Would you try to set the following value of ‘windowSoftInputMode’ property in your AndroidManifest.xml ?
Then remove your ‘platforms’ folder and rebuild. This should keep the input item on focus visible.


android:windowSoftInputMode=“adjustPan” >>> I have already tried this solution - it works, but I cannot use for my APP, since there is a button (-> SAVE) on toolbar that is pushed out from screen and not anymore visible to the user