Android 状态栏上方的导航抽屉应不透明
我可以在状态栏上方透明和半透明地显示导航抽屉,但我想,状态栏应完全不透明,导航抽屉标题的背景应完全为白色。我没有使用默认的导航抽屉活动,请不要建议我使用默认的导航抽屉活动 风格Android 状态栏上方的导航抽屉应不透明,android,navigation,styles,statusbar,Android,Navigation,Styles,Statusbar,我可以在状态栏上方透明和半透明地显示导航抽屉,但我想,状态栏应完全不透明,导航抽屉标题的背景应完全为白色。我没有使用默认的导航抽屉活动,请不要建议我使用默认的导航抽屉活动 风格 <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <!-- Custom
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
</resources>
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
样式-v21
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
</resources>
@颜色/原色
@颜色/原色暗
@颜色/颜色重音
假的
真的
真的
@android:彩色/透明
真的
主页
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/custom_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#3EB7C2"
android:fitsSystemWindows="true"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/logoheader"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:background="@mipmap/nav_header_logo" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFFFFF" />
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
当android:fitsystemwindows=“false”时
想要实现如下效果,背景色为白色
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/custom_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#3EB7C2"
android:fitsSystemWindows="true"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/logoheader"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.3"
android:background="@mipmap/nav_header_logo" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#FFFFFF" />
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
导航抽屉是否可以在状态栏上方完全打开
android:fitsystemwindows=“true”
false@Ibrahim你可以看到我得到的图像。但我希望它完全不透明。也就是说,状态栏不应该在导航抽屉和状态栏的重叠部分可见android:fitsystemwindows=“true”
false@Ibrahim你可以看到我得到的图像。但我希望它完全不透明。也就是说,状态栏不应该在导航抽屉和状态栏的重叠部分可见