这视图应该用于新材料设计的底部导航? [英] Which view should be used for new Material Design Bottom Navigation?

查看:110
本文介绍了这视图应该用于新材料设计的底部导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信你们都已经听说了另外底部导航的材料设计准则。我打算将它添加到我的应用程序。但是,我不知道该怎么对待它最好的办法是。什么样的看法将是最好的证明底部栏?

I am sure that y'all have heard about the addition of bottom navigation to the material design guidelines. I am planning on adding it to my app. However, I am not sure what the best way to approach it is. What kind of a view would be best to show the bottom bar?

推荐答案

A 的LinearLayout 相等权重的看法,水平方向。在drawableTop中的LinearLayout按钮设置为选择的图标。

A LinearLayout with equal weights for its views, horizontal orientation. Buttons in the LinearLayout with drawableTop set to the icon of choice.

将它添加到的底部:

在一个的FrameLayout或CoordinatorLayout你可以用 layout_gravity =底或在RelativeLayout的使用机器人将它添加到底部:layout_alignParentBottom =真正的

In a FrameLayout or CoordinatorLayout you can add it to the bottom with layout_gravity="bottom" or in a RelativeLayout use android:layout_alignParentBottom="true"

尺寸,字体大小等:

请参阅材料设计底部导航规格了解它边距和字体大小等:

Please refer to the material design bottom navigation specs about it for the margins and font sizes etc:

身高:56dp

图标:24×24dp

Icon: 24 x 24dp

内容定位:结果
  文本和图标的水平内居中
  视图。

Content alignment:
Text and icon are centered horizontally within view.

填充:


      
  • 6DP上面图标(活动视图),8DP上面图标(非活动视图)

  •   
  • 在文本10dp

  •   
  • 12dp左,文字的权

  •   

标签的文本:


      
  • 的Roboto定期14sp(活动视图)

  • Roboto Regular 14sp (active view)

的Roboto定期12SP(非活动视图)

Roboto Regular 12sp (inactive view)

上滚动隐藏

从Android设计支持库使用 CoordinatorLayout 。收藏此的LinearLayout作为XML的一个孩子,并设置<一个href=\"http://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.Behavior.html\"相对=nofollow>行为来躲上滚动。

Use a CoordinatorLayout from android design support library. Add this LinearLayout as a child in the xml and set a Behavior to to hide on scroll.

更新

现在有一个开源库,可用的是建立在规范:
https://github.com/roughike/BottomBar

There is now an open source library available that is built to spec: https://github.com/roughike/BottomBar

这篇关于这视图应该用于新材料设计的底部导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆