iOS-类似于 Android 的导航抽屉?

iOS-like Navigation Drawer for Android?

我正在寻找一种在 Android 上重现 iOS 的导航抽屉的方法。

我不知道如何重现它。

iOS 上的导航抽屉滑动所有上一页并在屏幕上保留它的一小部分,如下所示:

iOS like Navigation Drawer

与此同时,android 导航抽屉越过上一页并将其隐藏,如下所示:

Android like Navigation Drawer

这可能吗?

iOS 没有内置导航抽屉组件。您提供的第一个 link 包含自定义实现。最好的办法是使用第三方解决方案。比如比较流行的是SideMenu.

肯定的,在 Android 中很有可能。在您的 build.gradle 文件中添加以下内容:

dependencies {
   implementation 'com.infideap.drawerbehavior:drawer-behavior:0.2.2'
}

在布局中使用 android.support.design.widget.NavigationViewcom.infideap.drawerbehavior.AdvanceDrawerLayout 来实现这种类型的行为,如下所示:

<com.infideap.drawerbehavior.AdvanceDrawerLayout 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:background="@color/colorWhite"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_default"
        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:background="@color/colorWhite"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />
</com.infideap.drawerbehavior.AdvanceDrawerLayout>

有关实现和示例演示的更多信息,请关注此 link。希望这对您有所帮助!