首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Bottom Navigation底部导航栏

一、Bottom Navigation

这里我就不介绍Material Design(https://material.io/guidelines/material-design/introduction.html)了,想了解更多就去看看官网,来看看他们自己的Introduction:(温馨提示:由于本人英语水平有限,以下引用均用有道翻译来翻译)

We challenged ourselves to create a visual language for our users that synthesizes the classic principles of good design with the innovation and possibility of technology and science. This is material design. This spec is a living document that will be updated as we continue to develop the tenets and specifics of material design.

我们挑战自己,为我们的用户创造一种视觉语言,它综合了优秀设计的经典原则和技术和科学的可能性。这是材料设计。这个规范是一个活的文件,将会更新,因为我们继续发展的原则和材料设计的细节。

Bottom Navigation(https://material.io/guidelines/components/bottom-navigation.html#),想要使用Bottom Navigation,个人建议先看一下Bottom Navigation的设计,再来学习怎么用它。

Bottom navigation bars make it easy to explore and switch between top-level views in a single tap.

底部导航条使得在单个点击中探索和切换顶级视图变得很容易。

Tapping on a bottom navigation icon takes you directly to the associated view or refreshes the currently active view.

点击底部导航图标将直接带您到相关视图或刷新当前活动视图。

Bottom navigation is primarily for use on mobile. To achieve a similar effect for desktop, use side navigation.

底部导航主要用于移动设备。为了达到类似的效果,桌面,使用边导航。

Usage

Three to five top-level destinations

Destinations requiring direct access

3到5个顶级目的地

目的地需要直接访问

Color

Tint the active icon with the app’s primary color. Use black or white if the bottom navigation bar is already colored.

用app的主色来着色活动图标。如果底部导航栏已经着色,请使用黑色或白色。

Specs

Width of each action: The width of the view divided by the number of actions (with a max of 168dp and a minimum of 80dp)

Height: 56dp

Icon: 24 x 24dp

每个动作的宽度:视图的宽度除以操作数(最大值为168dp,最小为80dp)

高度:56 dp

图标:24×24 dp

二、使用

最快的方法就是在android studio中直接新建一个Bottom Navigation Activity。当然也可以新建一个Empty Activity。

首先添加以下依赖

1、MainActivity.java

2、activity_main.xml

3、navigation.xml,右击menu文件夹新建一个Menu resource file,name为navigation,由于我在这里使用了vector drawable,所以还要添加以下依赖。navigation.xml的代码如下:

三、上图来看看

运行截图如下:

上面是四个top-level destinations的,来看看3个的

对比一下,如果只有三个动作,则始终显示图标和文本标签

如果有四个或五个操作,则仅将非活动视图显示为图标。

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180505G07QGO00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券