0

I am trying to implement Translucent system bars and having some trouble with fitsSystemWindows preventing elements in the view from redrawing after they become hidden by an element like the keyboard.

As an example I have a submit button at the bottom of a form, if I start filling in the form the keyboard pops up, I enter data and then dismiss the keyboard and poof the submit button has gone.

I don't get this problem if I remove the fitsSystemWindows but then I have some major layout issues.

Here is the code:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
    <style name="PonyTheme" parent="@style/_PonyTheme">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowTranslucentNavigation">true</item>
    //this is the only line that causes a problem
        <item name="android:fitsSystemWindows">true</item>
    </style>
</resources>
EnduroDave
  • 1,013
  • 7
  • 18
  • 37
  • 2
    Where is this theme being used? You probably don't want your Activity to have `fitsSystemWindows` set. Rather, you'd want to set that on the root View of the layout that you set as the content view in your Activity. – Kevin Coppock May 29 '14 at 20:18
  • Yep I am using a custom theme that extends the holo.light theme. The custom theme is just some colouring from the http://android-holo-colors.com generator. I have `fitsSystemWindows` in the theme rather than the layout because I want to keep the action bar – EnduroDave May 29 '14 at 20:20
  • You don't need that in the theme to be able to keep the ActionBar. Just remove `fitsSystemWindows` from `PonyTheme`, and apply it to your content view layout. – Kevin Coppock May 29 '14 at 20:24
  • You're right. However, I still have the issue with the UI not redrawing – EnduroDave May 29 '14 at 20:36
  • 1
    Hard to say without seeing more, but perhaps [this](http://stackoverflow.com/questions/21092888/windowsoftinputmode-adjustresize-not-working-with-translucent-action-navbar/22266717#22266717) is related? – Kevin Coppock May 29 '14 at 20:38
  • Ah, found the problem. The content that was not redrawing was in a `scrollView`. It would seem this does not play well with `fitsSystemWindows`. Thanks for your help – EnduroDave May 29 '14 at 20:41
  • No problem, glad you figured it out. :) – Kevin Coppock May 29 '14 at 20:41

0 Answers0