appbar,工具栏,actionbar之间的确切区别是什么?以及什么时候专门使用它们? [英] what is exact difference between appbar, toolbar, actionbar ? and when to use them specifically?

查看:121
本文介绍了appbar,工具栏,actionbar之间的确切区别是什么?以及什么时候专门使用它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

appbar Toolbar Actionbar 之间的确切区别是什么?以及什么时候专门使用它们?我试图找到它们,但是这让我感到困惑,所以任何伙伴都可以向我解释它们之间的确切区别是什么以及何时使用它们,或者这是单个组件的相同名称吗?

what is exact difference between appbar, Toolbar, Actionbar? and when to use them specifically? I try to find about them but it make me confuse so can any buddy explain to me what is exact difference between them and when to use them or are this are the same name of the single component?

推荐答案

  1. 工具栏 在应用程序内容中使用的标准工具栏.
  1. Toolbar A standard toolbar for use within application content.

工具栏是在应用程序布局中使用的操作栏的概括.传统上,操作栏是由框架控制的Activity不透明窗口装饰的一部分,但 Toolbar 可以放置在视图层次结构中的任意嵌套级别.应用程序可以选择使用 setActionBar()方法将 Toolbar 指定为Activity的操作栏.

A Toolbar is a generalization of action bars for use within application layouts. While an action bar is traditionally part of an Activity's opaque window decor controlled by the framework, a Toolbar may be placed at any arbitrary level of nesting within a view hierarchy. An application may choose to designate a Toolbar as the action bar for an Activity using the setActionBar() method.

工具栏支持更集中的功能集.从头到尾,工具栏可能包含以下可选元素的组合:

Toolbar supports a more focused feature set than ActionBar. From start to end, a toolbar may contain a combination of the following optional elements:

  • 一个导航按钮.这可以是向上箭头,导航菜单切换,关闭,折叠,完成或应用程序选择的其他图示符号.此按钮应始终用于访问 Toolbar 的容器及其标志内容中的其他导航目标,或者以其他方式保留由 Toolbar 指示的当前上下文.导航按钮在工具栏的最小高度(如果已设置)内垂直对齐.

  • A navigation button. This may be an Up arrow, navigation menu toggle, close, collapse, done or another glyph of the app's choosing. This button should always be used to access other navigational destinations within the container of the Toolbar and its signified content or otherwise leave the current context signified by the Toolbar. The navigation button is vertically aligned within the Toolbar's minimum height, if set.

商标徽标图片.这可能会延伸到钢筋的高度,并且可以任意变宽.

A branded logo image. This may extend to the height of the bar and can be arbitrarily wide.

标题和副标题.标题应该是工具栏在导航层次结构中的当前位置以及其中包含的内容的路标.字幕(如果存在)应指示有关当前内容的任何扩展信息.如果应用使用徽标图像,则应强烈考虑省略标题和副标题.

A title and subtitle. The title should be a signpost for the Toolbar's current position in the navigation hierarchy and the content contained there. The subtitle, if present should indicate any extended information about the current content. If an app uses a logo image it should strongly consider omitting a title and subtitle.

一个或多个自定义视图.该应用程序可以将任意子视图添加到 Toolbar .它们将出现在布局中的此位置.如果子视图的 Toolbar.LayoutParams 的Gravity值为CENTER_HORIZONTAL,则在测量了所有其他元素之后,该视图将尝试在工具栏剩余的可用空间内居中.一个动作菜单.动作菜单将固定在 Toolbar 的末尾,提供一些频繁,重要或典型的动作,以及用于其他动作的可选溢出菜单.动作按钮在工具栏的最小高度(如果已设置)内垂直对齐.

One or more custom views. The application may add arbitrary child views to the Toolbar. They will appear at this position within the layout. If a child view's Toolbar.LayoutParams indicates a Gravity value of CENTER_HORIZONTAL the view will attempt to center within the available space remaining in the Toolbar after all other elements have been measured. An action menu. The menu of actions will pin to the end of the Toolbar offering a few frequent, important or typical actions along with an optional overflow menu for additional actions. Action buttons are vertically aligned within the Toolbar's minimum height, if set.

2. 操作栏 操作栏是每个屏幕顶部的专用房地产,通常在整个应用程序中都存在.

2.Actionbar The action bar is a dedicated piece of real estate at the top of each screen that is generally persistent throughout the app.

它提供了几个关键功能:

It provides several key functions:

  • 使重要的动作突出并以可预测的方式(例如新建"或搜索")可以访问.

  • Makes important actions prominent and accessible in a predictable way (such as New or Search).

支持应用内一致的导航和视图切换.

Supports consistent navigation and view switching within apps.

通过为很少使用的动作提供动作溢出来减少混乱.

Reduces clutter by providing an action overflow for rarely used actions.

提供专用空间,为您的应用提供标识.

Provides a dedicated space for giving your app an identity.

3. Appbar 应用程序栏(也称为操作栏)是应用程序活动中最重要的设计元素之一,因为它提供了用户熟悉的视觉结构和交互式元素.使用应用程序栏可以使您的应用程序与其他Android应用程序保持一致,从而使用户可以快速了解如何操作您的应用程序并获得良好的体验.应用栏的主要功能如下:

3.Appbar The app bar, also known as the action bar, is one of the most important design elements in your app's activities, because it provides a visual structure and interactive elements that are familiar to users. Using the app bar makes your app consistent with other Android apps, allowing users to quickly understand how to operate your app and have a great experience. The key functions of the app bar are as follows:

  • 专用空间,用于为您的应用提供身份并指示用户在应用中的位置.

  • A dedicated space for giving your app an identity and indicating the user's location in the app.

以可预测的方式访问重要动作,例如搜索.

Access to important actions in a predictable way, such as search.

支持导航和视图切换(带有选项卡或下拉列表).

Support for navigation and view switching (with tabs or drop-down lists).

编辑

动作栏传统上是框架控制的Activity不透明窗口装饰的一部分,但是工具栏可以放置在视图层次结构中的任何嵌套级别.工具栏提供了比 ActionBar 更多的功能.工具栏可能从头到尾包含元素的组合.

An Action bar is traditionally a part of an Activity opaque window decor controlled by the framework but a Toolbar may be placed at any level of nesting within a view hierarchy. The toolbar provides more feature than ActionBar. A Toolbar may contain a combination of elements from start to end.

工具栏的 ActionBar 更灵活.我们可以轻松地修改其颜色,大小和位置.我们还可以在其中添加标签,徽标,导航图标和其他视图.在Material Design中,Android更新了AppCompat支持库,以便我们可以在运行API级别7以上的设备中使用工具栏 ...

Toolbar’s are more flexible than ActionBar. We can easily modify its color, size and position. We can also add labels, logos, navigation icons and other views in it. In Material Design Android has updated the AppCompat support libraries so that we can use Toolbar’s in our devices running API Level 7 and up...

这篇关于appbar,工具栏,actionbar之间的确切区别是什么?以及什么时候专门使用它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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