Tech tip of this week

Android L: Tool Bar widget

Toolbar widget introduced in Android 5.0(API 21).This widget also available in support library for older versions.

A Toolbar is a generalization of action bars.

Toolbar supports a more focused feature set than ActionBar. The new Toolbar contains the following 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.
  • 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.

Different types of Toolbar examples:

No comments:

Post a Comment