gpt4 book ai didi

android - Navigation Drawer 与 Action Bar 略微重叠

转载 作者:行者123 更新时间:2023-11-29 01:27:40 25 4
gpt4 key购买 nike

我为我的应用制作了一个抽屉导航。我无法将抽屉导航对齐到操作栏下方。这是我的 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" tools:openDrawer="start">

<include layout="@layout/app_bar_main" android:layout_width="match_parent"
android:layout_height="match_parent" />

<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:fitsSystemWindows="true"
android:layout_marginTop="?attr/actionBarSize"
app:headerLayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer" />

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

我已经尝试了 android:layout_marginTop="@dimen/abc_action_bar_default_height_material"android:layout_marginTop="?attr/actionBarSize" 但我仍然得到轻微的重叠可以在下面的照片中看到:

Exhibit A

这就是 app_bar_main.xml 的样子:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
tools:context=".MainActivity">

<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />

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

<include layout="@layout/content_main" />


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

最佳答案

更改 NavigationView、DrawerLayout 和 CoordinatorLayout 中的 android:fitsSystemWindows="false"。这同时删除重叠。但是您会发送一个白色的状态栏。

关于android - Navigation Drawer 与 Action Bar 略微重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32998401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com