Question

I'm trying to make just one activity of my app overflowing behind the software keys, like this

Activity Overflowing Software Keys Bar

What I already did was to put in my theme definition the following statements

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

and then enabled it on the listView I wanted to overlap

android:fitsSystemWindows="true"
android:clipToPadding="false"

What happened was that my app did overlap on status bar and button bar, but this on EVERY activity and not just on the one I put the two rows above.

Also, it messed up my activity margins: the first row of my application drawer is hidden, and the top of my main fragment as well.

Activity overlapping top bar. Not the way I wanted it to...

I thought fitsSystemWindows was meant to solve this kind of issues, so I added it to my theme

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

but nothing changed.

So the question is apparently simple: how can I get the translucent bottom bar, with one of my activities flowing behind it, without messing up the top part of my app and without (if possible) having the same effect on all other activities?

Thank you in advance to each of you fellow helpers.

Was it helpful?

Solution

As Eluvatar stated if I need to have this effect on just one activity the best thing to do is to define a custom theme and assign it just to this activity. That's what I did, I defined an empty style in styles.xml and overrided it in values-v19/styles.xml putting just

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

Then I assigned - in AndroidManifest.xml, the proper style to the activity by using

android:theme="@style/Theme.Style.I.Created.For.This.Activity"

Disabling the first row allowed the activity to just overlap the navigation bar without popping out on the status bar. Margins seem ok as well.

I hope this is going to help somebody else someday.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top