Android7.0中文文档(API)-- Toolbar

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/Toolbar.html

Toolbar

public class Toolbar
extends ViewGroup

java.lang.Object
   ↳android.view.View
    ↳android.view.ViewGroup
     ↳android.widget.Toolbar


A standard toolbar for use within application content.
一个用于应用程序内容的标准工具栏。

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是action bars的一个范例,它用于应用程序布局内部。虽然操作栏通常是由框架控制的Activity's的不透明窗口的一部分,但是Toolbar可以嵌套放置在视图层次结构中的任意层次中。应用程序可以选择将Toolbar指定为使用setActionBar()方法的Activity的操作栏。

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

  • 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.
  • 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.

Toolbar比ActionBar支持更多的主要功能。从开始到结束,Toolbar可能包含以下可选元素的组合:
  • 一个导航按钮。这个按钮可以是一个向上的箭头,导航菜单切换,关闭,折叠收起,完成或者应用程序选择的其他符号。这个按钮应该总是用来访问在容器中的Toolbar和内容符号的其他导航目标,否则就会离开Toolbar所显示的当前上下文。如果设置,导航按钮与ToolBar的minimum height垂直对齐。
  • 应用程序Logo图像。它可以扩展到Toolbar的高度,并且可以任意宽。
  • 一个标题和副标题。标题是Toolbar在导航层次结构中的当前位置和所包含的内容的一个说明。如果有副标题,则这个副标题应该表明关于当前内容的任何扩展信息。如果应用程序使用了Logo图像,应该考虑省略标题和副标题。
  • 一个或多个自定义视图。应用程序可以在Toolbar中添加任意的子视图。它们会出现在布局中的这个位置。如果子视图的Toolbar.LayoutParams设置了GravityCENTER_HORIZONTAL,则将在测量所有其他元素都之后,在Toolbar中剩余的可用空间中视图尝试居中。
  • 一个action menu操作菜单将会在Toolbar的末尾处提供一些常见的、重要的或典型的操作,以及附加操作的可选溢出菜单。如果设置,操作按钮与ToolBar的minimum height垂直对齐。

In modern Android UIs developers should lean more on a visually distinct color scheme for toolbars than on their application icon. The use of application icon plus title as a standard layout is discouraged on API 21 devices and newer.
在现代的Android UI中,开发者应该更多地关注工具条Toolbar的视觉色彩方案,而不是他们的应用图标。应用程序图标加上标题作为标准布局,在API 21设备和更新的设备上都是不推荐的。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值