Home » Android » Keyboard hiding EditText when android:windowTranslucentStatus=true

Keyboard hiding EditText when android:windowTranslucentStatus=true

Posted by: admin April 23, 2020 Leave a comment


We’re applying the new Android KitKat translucent theme in our apps, and we’re getting a weird issue when the keyboard appears. If we don’t use the new android:windowTranslucentStatus attribute, all works as usual: The screen is resized, and all remains visible. But when we’re using android:windowTranslucentStatus, the screen isn’t resized and our EditText becomes hidden by the keyboard.

A sample of the issue:

The only difference between the screens is in the attribute in the style:

First screen:
<item name="android:windowTranslucentStatus">false</item>

Second screen:
<item name="android:windowTranslucentStatus">true</item>

We think this is a bug from Kitkat release, but we want you to be aware of this. We’re getting a little mad. Of course, if someone have a solution, it will be amazing.

EDIT: I just added this issue to the Android issue tracker. Probably you’ll be interested in starring the issue: https://issuetracker.google.com/issues/36986276

How to&Answers:

I also ran into this very annoying issue. But eventually I got this working:

<style name="Theme.MyApp">
    <item name="android:windowTranslucentStatus">true</item>

Instead of setting fitSystemWindows=”true” in the theme, I set it on the root view of my layout..


        android:layout_height="wrap_content" />


I also use the great SystemBarTintManager in my activity:

new SystemBarTintManager(this).setStatusBarTintEnabled(true);

This seems to work well, but admittedly seems pretty fickle. Hope it helps someone anyway!


A workaround would be:

Add a Touch or Focus or ClickListener and move up the EditText holding layout up to half of the screen. However this is really not the way it should work, so keep your fingers crossed and hope that Google gets it fixed.

EditText e = new EditText(this);
    e.setOnFocusChangeListener(new OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {

Just adjust v to your holding layout and make sure the positions you move to look good.


put this below lines after oncreate in you activity

    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        Window window = this.getWindow();

Work for me 🙂


This isn’t a perfect solution but a workaround I found was to set android:windowSoftInputMode="adjustPan" in AndroidManifest.xml.

Note that this will pan the whole window out of the way of the keyboard, rather than resizing it.

More info here (search for windowSoftInputMode).


set android:windowSoftInputMode="adjustPan" in AndroidManifest.xml is ok. But i just want to say that it not work when activity is FullScreen, for more details see Android How to adjust layout in Full Screen Mode when softkeyboard is visible


Add the following as well

<item name="android:fitsSystemWindows">true</item>