Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard hiding EditText when android:windowTranslucentStatus=true

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: http://fewlaps.com/xtra/quitnowStackoverflow.png

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

like image 683
Roc Boronat Avatar asked Nov 11 '13 01:11

Roc Boronat


1 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> </style> 

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

<FrameLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:fitsSystemWindows="true"     android:layout_width="match_parent"     android:layout_height="match_parent">      <EditText         android:layout_width="wrap_content"         android:layout_height="wrap_content" />  </FrameLayout> 

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!

like image 105
DanielGrech Avatar answered Oct 04 '22 12:10

DanielGrech