Trouble with tabs and translucent statusbar/navigation for android 4.4-ThrowExceptions

Exception or error:

I want to add translucent statusbar and navigation to my app (for kitkat) and on most places it works well.

I have a theme with:

    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowTranslucentStatus">true</item>

and in my layouts I have android:fitsSystemWindows="true"

For normal activities this works fine, but I have two activities that make trouble. -> The content is shown behind the statusbar and my actionbar.

One of them is the PreferenceActivity were I fixed it by adding findViewById(android.R.id.list).setFitsSystemWindows(true);

The second is an Activity with ActionBar.NAVIGATION_MODE_TABS and there I can’t find the right target for the setFitsSystemWindows(true) call.

I tried with findViewById(android.R.id.content) and findViewById(android.R.id.tabcontent). I also tried to add the xml attribute to the layout of my fragment but no success.

How to solve:

Add a 25 dp paddingTop on your toolbar

Leave a Reply

Your email address will not be published. Required fields are marked *