如何在 Android 中执行下拉导航之类的操作(因为它看起来已被弃用?)

How to do something like Drop Down Navigation in Android (since it looks like it has become deprecated?)

编辑:我在这里也问了一个相关问题:


如何在我的应用程序中制作其中一个? 在我的特定实例中,我想使用下拉菜单在我的 "Master-Detail" 设计模式的 "Detail" 视图中过滤屏幕,并且在这种情况下使用抽屉似乎有点奇怪,尽管看起来下拉菜单已被弃用并被导航抽屉取代。

我在这里 http://developer.android.com/guide/topics/ui/actionbar.html 找到了一个模糊的教程,但我在网上找不到任何好的 Stack Overflow 问题或任何好的教程来证明这一点。

我也很担心它是否真的被弃用了。我打开我的 Google 日历应用程序,发现它已被替换为 "drawer",如下所示:

我只想要 "filters" 在屏幕上显示的内容,类似于这个想法。

在 Google 的弃用网页上,它说:

Implement ActionBar.OnNavigationListener to define the behavior that occurs when the user selects an item from the list.

它 link 到 http://developer.android.com/reference/android/support/v7/app/ActionBar.OnNavigationListener.html

上面写着:

This interface is deprecated. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

我去了 link、http://developer.android.com/design/patterns/navigation.html,但找不到下拉菜单之类的东西。它主要讨论是否应该单击 "Up" 与 "Back" 按钮。

那么,如何在 Android 中执行下拉导航之类的操作(因为它看起来已被弃用?) 我是否只需要开始使用抽屉?在我的特定实例中,我想使用下拉菜单在我的 "Master-Detail" 设计模式的 "Detail" 视图中过滤屏幕,并且在这种情况下使用抽屉似乎有点奇怪。

使用 API 21 方法 setNavigationMode(ActionBar.NAVIGATION_MODE_LIST) 已弃用。

使用微调器的最佳方式是像这样使用工具栏:

<android.support.v7.widget.Toolbar
    android:id="@+id/toolbar_actionbar"
    android:layout_height="?attr/actionBarSize"
    android:layout_width="match_parent"
    android:background="?attr/colorPrimary">

<Spinner
        android:id="@+id/spinner_toolbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

您可以在 Google IO 2014

中找到示例