2016-08-08 8 views
4

Wer weiß, wie statusbar aussehen wie Google Maps zu machen?Wie kann ich die Statusleiste meiner Apps wie Google Maps aussehen lassen?

enter image description here

enter image description here

schaffe ich für meine Schublade Layout mit android:fitsSystemWindows="true" und

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

Layout transparent Status zu erhalten -> 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> 

Werte-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> 

Dank.

+3

Mögliche Duplikat [Android transparente Statusleiste und Aktionsleiste] (Http://stackoverflow.com/questions/29907615/android-transparent-status-bar-and-actionbar) – skydroid

Antwort

0

Sie tun können es Themen mit:

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

oder programmatisch:

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

Für weitere Informationen lesen Sie können:

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

Verwandte Themen