我正在使用 Java 在 Android Studio 中工作。我想实现一个导航抽屉(那些从左到右滑动的),汉堡图标总是在顶部。但是有一些“顶级目的地”的问题,没有这个汉堡图标就不会出现。我找到的解决方案之一是将该活动作为我的 Launcher 活动,但我不希望这样。
有人可以向我解释这个“顶级目的地”短语的含义以及我的导航抽屉问题的可能解决方法!
这是我的导航布局
<androidx.drawerlayout.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:layout_width="match_parent"
android:id="@+id/drawer_layout"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:visibility="visible"
tools:context=".Main_Screen"
tools:openDrawer="start">
<include
layout="@layout/app_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/nav_view"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:menu="@menu/drawer_menu"
app:headerLayout="@layout/drawer_header"
/>
</androidx.drawerlayout.widget.DrawerLayout>
这是包含的应用栏
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
style="@style/Widget.MaterialComponents.AppBarLayout.Primary">
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:id="@+id/toolbar"
app:contentInsetStartWithNavigation="0dp" />
</com.google.android.material.appbar.AppBarLayout>
</LinearLayout>