首页 > 解决方案 > Android 导航抽屉在顶部添加了一个带有较暗阴影的空白空间

问题描述

我正在尝试显示 make ui,其中导航抽屉在工具栏下方显示类似这样的内容

我希望导航栏显示在工具栏下,所以我在导航视图中添加了marign。

但实际上它就像这个输出屏幕一样出来 ,它在顶部添加了 16 dp 的填充/边距,顶部有较深的阴影。我试过了,但它不起作用。有人可以帮忙吗?

appcompat 版本是 28.0.0 谁能帮忙

<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"
    tools:openDrawer="start"
    android:background="@color/secondaryColor">

    <include
        android:id="@+id/include_layout_home_screen"
        layout="@layout/activity_home_screen"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_drawer"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        android:background="@color/primaryColor"
        app:itemTextColor="@color/colorLabelGreyed"
        app:itemIconTint="@color/secondaryColor"
        app:menu="@menu/activity_naviagtion_drawer_drawer"
        android:layout_marginTop="84dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_gravity="bottom"
            android:paddingBottom="24dp"
            android:paddingLeft="16dp">
            <android.support.v7.widget.AppCompatImageView
                android:id="@+id/facebook_btn"
                android:layout_gravity="center_vertical"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:src="@drawable/ic_facebook_icon"
                android:paddingRight="10dp"/>
            <android.support.v7.widget.AppCompatImageView
                android:id="@+id/instagram_btn"
                android:layout_gravity="center_vertical"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:src="@drawable/ic_instagram_icon"
                android:paddingRight="10dp"/>

            <android.support.v7.widget.AppCompatImageView
                android:id="@+id/twitter_btn"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_vertical"
                android:paddingRight="10dp"
                android:src="@drawable/ic_twitter_icon" />
        </LinearLayout>

        </android.support.design.widget.NavigationView>

  </android.support.v4.widget.DrawerLayout>




<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:focusableInTouchMode="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:theme="@style/AppTheme.AppBarOverlay"
        android:background="@color/primaryDarkColor"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
        <include
            android:layout_width="match_parent"
            android:layout_height="@dimen/app_bar_height"
            layout="@layout/app_toolbar"/>
    </android.support.design.widget.AppBarLayout>

标签: androidandroid-layoutnavigationnavigation-drawer

解决方案


推荐阅读