Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make my apps statusbar look like google maps?

Does anyone know how to make statusbar look like google maps?

enter image description here

enter image description here

I manage to get transparent status for my drawer layout using android:fitsSystemWindows="true" and

<item name="android:statusBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item>

layout -> activity_main.xml

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">...
<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:headerLayout="@layout/nav_main_header" />
</android.support.v4.widget.DrawerLayout>

values-v21 -> styles.xml

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:navigationBarColor">@android:color/transparent</item>
</style>

Thanks.

like image 691
Povilas Brazys Avatar asked Oct 29 '22 22:10

Povilas Brazys


1 Answers

You may do it using themes:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

Or programmatically:

getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);

For more information you may read:

https://developer.android.com/about/versions/android-4.4.html#UI https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_TRANSLUCENT_NAVIGATION

like image 101
Kamran Ahmed Avatar answered Nov 15 '22 07:11

Kamran Ahmed