Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with tabs and translucent statusbar/navigation for android 4.4

Tags:

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.

like image 486
Dodge Avatar asked Dec 30 '13 15:12

Dodge


1 Answers

Add a 25 dp paddingTop on your toolbar

like image 64
alvarlagerlof Avatar answered Oct 21 '22 05:10

alvarlagerlof