本文翻译自:Navigation Drawer (Google+ vs. YouTube)

Does anyone know how to implement a sliding menu like some of the top apps of today? 有谁知道如何实现像今天的一些顶级应用程序的滑动菜单?

Other Stack Overflow questions haven't had any answers on how to do this, so I'm trying to gather as much info to help out others. 其他Stack Overflow 问题对于如何做到这一点没有任何答案,所以我试图收集尽可能多的信息来帮助其他人。 All the applications I mention below do a great job of implementing the slide menu. 我在下面提到的所有应用程序都可以很好地实现幻灯片菜单。

1. Google Plus (as of 7/7/12) 1. Google Plus(截至2012年7月7日)

You can only go from the first screen to the second screen by clicking the G+ logo in the upper left hand corner. 您只能通过单击左上角的G +徽标从第一个屏幕转到第二个屏幕。 Notice that the entire screen moves from it's position and get's nudged to the right side of the screen (including the action bar). 请注意,整个屏幕从其位置移动并轻推到屏幕右侧(包括操作栏)。 To get back to the first screen you can either slide the right side back into focus or you can click the G+ icon again. 要返回第一个屏幕,您可以将右侧滑回焦点,也可以再次单击G +图标。

2. YouTube (as of 7/7/12) 2. YouTube(截至2012年7月7日)

You can go from the first screen to second screen using two methods. 您可以使用两种方法从第一个屏幕进入第二个屏幕。 Either click the YouTube logo in the upper left, or you can use a swipe gesture to move it to the right. 您可以点击左上方的YouTube徽标,也可以使用滑动手势将其移到右侧。 This is already different from the G+ app. 这已经与G + app不同了。 Secondly, you can see that the action bar stays put (Unlike G+). 其次,您可以看到操作栏保持不变(与G +不同)。 Lastly, to get the original screen back it works just like G+. 最后,为了获得原始屏幕,它就像G +一样工作。


#1楼

参考:https://stackoom.com/question/ljnc/导航抽屉-Google-与YouTube


#2楼

Edit #3: 编辑#3:

The Navigation Drawer pattern is officially described in the Android documentation! 导航抽屉模式在Android文档中正式描述!

Check out the following links: 查看以下链接:

  • Design docs can be found here . 设计文档可以在这里找到。
  • Developer docs can be found here . 开发人员文档可以在这里找到。

Edit #2: 编辑#2:

Roman Nurik (an Android design engineer at Google) has confirmed that the recommended behavior is to not move the Action Bar when opening the drawer (like the YouTube app). Roman Nurik(Google的Android设计工程师)已确认建议的行为是在打开抽屉时不移动操作栏(如YouTube应用程序)。 See this Google+ post . 查看此Google+信息 。


Edit #1: 编辑#1:

I answered this question a while ago, but I'm back to re-emphasize that Prixing has the best fly-out menu out there... by far . 我刚才回答了这个问题,但我又重新强调, Prix​​ing有最好的飞出菜单......到目前为止 It's absolutely beautiful, perfectly smooth, and it puts Facebook, Google+, and YouTube to shame. 这绝对是美丽的,非常流畅,它让Facebook,Google +和YouTube蒙羞。 EverNote is pretty good too... but still not as perfect as Prixing. EverNote也很不错......但仍然不如Prixing那么完美。 Check out this series of posts on how the flyout menu was implemented (from none other than the head developer at Prixing himself!). 查看关于如何实施弹出菜单的这一系列帖子 (来自Prixing本人的首席开发人员!)。


Original Answer: 原答案:

Adam Powell and Richard Fulcher talk about this at 49:47 - 52:50 in the Google I/O talk titled "Navigation in Android". Adam Powell和Richard Fulcher在49:47 - 52:50的Google I / O谈话中谈到了这一点,题为“Android中的导航”。

To summarize their answer, as of the date of this posting the slide out navigation menu is not officially part of the Android application design standard. 为了总结他们的答案,截至本发布日期,滑出导航菜单不是 Android应用程序设计标准的正式部分。 As you have probably discovered, there's currently no native support for this feature, but there was talk about making this an addition to an upcoming revision of the support package. 正如您可能已经发现的那样,目前没有对此功能的原生支持,但有人谈到将此添加到即将推出的支持包修订版中。

With regards to the YouTube and G+ apps, it does seem odd that they behave differently. 关于YouTube和G +应用程序,它们表现不同似乎很奇怪。 My best guess is that the reason the YouTube app fixes the position of the action bar is, 我最好的猜测是YouTube应用程序修复操作栏位置的原因是,

  1. One of the most important navigational options for users using the YouTube app is search, which is performed in the SearchView in the action bar. 使用YouTube应用的用户最重要的导航选项之一是搜索,该操作在操作栏的SearchView中执行。 It would make sense to make the action bar static in this regard, since it would allow the user to always have the option to search for new videos. 在这方面使操作栏保持静态是有意义的,因为它将允许用户始终具有搜索新视频的选项。

  2. The G+ app uses a ViewPager to display its content, so making the pull out menu specific to the layout content (ie everything under the action bar) wouldn't make much sense. G +应用程序使用ViewPager来显示其内容,因此制作特定于布局内容的拉出菜单(即操作栏下的所有内容)都没有多大意义。 Swiping is supposed to provide a means of navigating between pages, not a means of global navigation. 刷卡应该提供在页面之间导航的方式,而不是全局导航的方式。 This might be why they decided to do it differently in the G+ app than they did in the YouTube app. 这可能就是为什么他们决定在G +应用程序中使用不同于YouTube应用程序的方式。

    On another note, check out the Google Play app for another version of the "pull out menu" (when you are at the left most page, swipe left and a pull out, "half-page" menu will appear). 另请注意,请查看Google Play应用以获取其他版本的“拉出菜单”(当您位于最左侧页面时,向左滑动并拉出,“半页”菜单将会出现)。

You're right in that this isn't very consistent behavior, but it doesn't seem like there is a 100% consensus within the Android team on how this behavior should be implemented yet. 你是对的,这不是非常一致的行为,但似乎在Android团队中对于如何实现这种行为没有100%的共识。 I wouldn't be surprised if in the future the apps are updated so that the navigation in both apps are identical (they seemed very keen on making navigation consistent across all Google-made apps in the talk). 如果将来应用程序更新以便两个应用程序中的导航相同(我们似乎非常热衷于在谈话中使所有Google制造的应用程序中的导航保持一致),我不会感到惊讶。


#3楼

Just recently I forked a current Github project called "RibbonMenu" and edited it to fit my needs: 就在最近,我分叉了一个名为“RibbonMenu”的当前Github项目并编辑它以满足我的需求:

https://github.com/jaredsburrows/RibbonMenu https://github.com/jaredsburrows/RibbonMenu

What's the Purpose 目的是什么?

  • Ease of Access: Allow easy access to a menu that slides in and out 易于访问:允许轻松访问滑入和滑出的菜单
  • Ease of Implementation: Update the same screen using minimal amount of code 易于实施:使用最少量的代码更新同一屏幕
  • Independency: Does not require support libraries such as ActionBarSherlock 独立性:不需要ActionBarSherlock等支持库
  • Customization: Easy to change colors and menus 定制:易于更改颜色和菜单

What's New 什么是新的

  • Changed the sliding animation to match Facebook and Google+ apps 更改了滑动动画以匹配Facebook和Google+应用
  • Added standard ActionBar (you can chose to use ActionBarSherlock) 添加标准ActionBar(您可以选择使用ActionBarSherlock)
  • Used menuitem to open the Menu 使用menuitem打开菜单
  • Added ability to update ListView on main Activity 添加了在主Activity上更新ListView的功能
  • Added 2 ListViews to the Menu, similiar to Facebook and Google+ apps 在菜单中添加了2个ListView,类似于Facebook和Google+应用程序
  • Added a AutoCompleteTextView and a Button as well to show examples of implemenation 添加了AutoCompleteTextView和Button以显示实现示例
  • Added method to allow users to hit the 'back button' to hide the menu when it is open 添加了允许用户点击“后退按钮”以在打开时隐藏菜单的方法
  • Allows users to interact with background(main ListView) and the menu at the same time unlike the Facebook and Google+ apps! 与Facebook和Google+应用程序不同,允许用户同时与后台(主ListView)和菜单进行交互!

ActionBar with Menu out 带菜单的ActionBar

ActionBar with Menu out and search selected 选择了菜单输出和搜索的ActionBar


#4楼

Personally I like the navigationDrawer in Google Drive official app. 我个人喜欢Google Drive官方应用中的navigationDrawer It just works and works great. 它只是工作和工作很好。 I agree that the navigation drawer shouldn't move the action bar because is the key point to open and close the navigation drawer. 我同意导航抽屉不应移动操作栏,因为它是打开和关闭导航抽屉的关键点。

If you are still trying to get that behavior I recently create a project Called SherlockNavigationDrawer and as you may expect is the implementation of the Navigation Drawer with ActionBarSherlock and works for pre Honeycomb devices. 如果您仍在尝试获取该行为,我最近创建了一个名为SherlockNavigationDrawer的项目,您可能期望使用ActionBarSherlock实现导航抽屉,并适用于蜂窝前设备。 Check it: 核实:

SherlockNavigationDrawer github SherlockNavigationDrawer github


#5楼

There is a great implementation of NavigationDrawer that follows the Google Material Design Guidelines (and compatible down to API 10) - The MaterialDrawer library (link to GitHub) . 有一个很棒的NavigationDrawer实现遵循Google Material Design Guidelines(兼容到API 10) - MaterialDrawer库(链接到GitHub) 。 As of time of writing, May 2017, it's actively supported. 截至2017年5月,它已得到积极支持。

It's available in Maven Central repo . 它可以在Maven Central repo中找到 。 Gradle dependency setup: Gradle依赖设置:

compile 'com.mikepenz:materialdrawer:5.9.1'

Maven dependency setup: Maven依赖设置:

<dependency><groupId>com.mikepenz</groupId><artifactId>materialdrawer</artifactId><version>5.9.1</version>
</dependency>


#6楼

我知道这是一个老问题,但最新的答案是使用Android支持设计库 ,让您的生活更轻松。

导航抽屉(Google+与YouTube)相关推荐

  1. 谷歌抽屉_Google(最终)会杀死导航抽屉吗?

    谷歌抽屉 A couple of months ago Google has celebrated with enthusiasm 15 years of Google Maps, one of th ...

  2. Android开发之Navigationdrawer导航抽屉功能的实现(源代码分享)

    导航抽屉(navigationdrawer)是一个从屏幕左边滑入的面板,用于显示应用的主要导航项目.用户可以通过在屏幕左边缘滑入或者触摸操作栏的应用图标打开导航抽屉.导航抽屉覆盖在内容之上,但不覆盖操 ...

  3. android fragment 抽屉,android – 更改Fragment中的导航抽屉项目

    我有一个MainActivity启动导航抽屉. 也有一些碎片. 我需要从片段内部更改导航抽屉列表的标题. 我尝试了这个内部片段: navMenuTitles = getActivity().getRe ...

  4. android 导航抽屉_Android导航抽屉示例教程

    android 导航抽屉 In this tutorial we'll implement a Navigation Drawer in our android application. Androi ...

  5. android 抽屉菜单栏,android – 导航抽屉列表中的下划线菜单项

    如何在导航抽屉中下划线菜单项? 期望: 现实: @菜单/ activity_navigation_drawer: android:id="@+id/nav_open_account" ...

  6. Google收购YouTube,百度将收购谁?

    近日来,google收购youtube在业内又引起了一番波澜.两个不满30岁的人再一次成为了人们的焦点,吸引全世界的眼球. IT业收购之风又起. 最近美国新闻集团收购了MySpace网站. 思科系统公 ...

  7. Android Navigation Drawer(导航抽屉)

    Google I/O 2013 Android 更新了Support库,新版本的Support库中新加入了几个比较重要的功能. 添加 DrawerLayout 控件,支持创建  Navigation ...

  8. Google | 创造Youtube单次上线最高收益!解决推荐中的信息茧房困境

    星标/置顶小屋,带你解锁 最萌最前沿的NLP.搜索与推荐技术 文 | 江城 编 |  夕小瑶 今天分享一下Google在WSDM 2019的一篇将强化学习应用于Youtube推荐的论文,作者宣称是获得 ...

  9. android 导航自动切换,Android导航抽屉切换图标向右

    吃鸡游戏 我为EndDrawerToggle该类编写了一个与您的设置非常相似的设置- DrawerLayout带末端对齐的抽屉View,AppCompatActivity带有自定义Toolbar的支持 ...

最新文章

  1. 经典文章之java 操纵Excel[转]
  2. action和servlet的关系
  3. 一个页面区分管理者和普通用户如何设计_电商系统:优惠券原型设计说明(二)...
  4. linux修改文件句柄数生效_linux修改句柄数
  5. 文件和目录(一)--unix环境高级编程
  6. Cholesky分解法
  7. 机械制图类毕业论文文献有哪些?
  8. c语言学习——设圆半径r = 1.5,圆柱高h = 3,求圆周长,圆面积,圆球表面积,圆球体积,圆柱体积
  9. Addressing Failure Prediction by Learning Model Confidence
  10. numpy学习:np.subtract.outer
  11. YYText-显示富文本
  12. 设置网页默认为360浏览器极速模式打开
  13. 人脸检测和行人检测2:YOLOv5实现人脸检测和行人检测(含数据集和训练代码)
  14. Start Developing iOS Apps (Swift) 学习笔记 (1)
  15. (Flutter2) AS导入老项目报错:inheritFromWidgetOfExactType
  16. MySQL锁:全局锁、表级锁和行锁
  17. 菜鸟学Android源码——Setting(1)
  18. [jdk]jdk7,jdk8,jdk14 linux版本,windows版本下载
  19. VS2010 MFC Excel(1)
  20. 螺旋节能灯和U型节能灯相比有哪些优点?

热门文章

  1. 模式识别之knn---KNN(k-nearest neighbor algorithm)--从原理到实现
  2. JVM系列五:垃圾回收器
  3. CLR 4.0 有哪些新东西? What's new in CLR 4.0--类型嵌入 Type embedding
  4. [Lydsy1806月赛] 最长公共子序列
  5. 利尔达NB-IOT的PSM和eDRX低功耗模式笔记
  6. 观察者模式 - dom事件 / 自定义事件 / Promise 我的理解
  7. 关于数据库#1063 - Incorrect column specifier for column 'xxx'异常
  8. ACM学习历程—HDU5668 Circle(数论)
  9. jQuery Live Query 插件
  10. genlist -s 192.168.21.\*