I am working on creating an app with lollipop toolbar with translucent status bar to have the status bar also tinted. It is working fine with the true property.
It is just that the toolbar is overlapping with the status bar now which looks messy. What is the option to position the toolbar below the status bar with maintaining the window translucent status?
Code Snippets :
<style name="Theme.XXX" parent="Theme.AppCompat">
<item name="colorPrimary">...</item>
<item name="colorPrimaryDark">...</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="windowActionBar">false</item>
<item name="colorAccent">...</item>
</style>
Toolbar code used in activity:
<android.support.v7.widget.Toolbar
android:id="@+id/main_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/XXX"
android:elevation="5dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/Theme.XXX" />
Thanks in advance.
You can show app content behind the status bar using SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN You should also use SYSTEM_UI_FLAG_LAYOUT_STABLE to help your app maintain stable layout.
According to the official documentation it's a. Boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows.
What is the size of status bar? Official height is 24dp , as is stated officially by Google on Android Design webpage. Save this answer.
as Virus correctly says, the answer is here: Toolbar overlapping below status bar
Simply add the attribute
android:fitsSystemWindows="true"
into the xml item and it will work fine :)
I guess you are using fitSystemWindows
property.
Turn off that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With