Toolbar

Dialer uses the chassis toolbar with a package name of com.android.car.ui.toolbar.Toolbar. The first step to customizing the toolbar is to overlay the layout file, which is car_ui_toolbar.xml and car_ui_toolbar_two_row.xml for the legacy toolbar, and car_ui_base_layout_toolbar.xml for the base layout version. In each version of the layout, each of the following views must be provided with the respective ids:

id View type Description
car_ui_toolbar_background/td> android.view.View Deprecated for base layouts, but used with the previous toolbar style to determine height.
car_ui_toolbar_tabs com.android.car.ui.toolbar.TabLayout Location of tabs.
car_ui_toolbar_nav_icon android.widget.ImageView The Back, Close, Down button.
car_ui_toolbar_logo android.widget.ImageView The logo, when car_ui_toolbar_logo_
fills_nav_icon_space is true.
car_ui_toolbar_nav_icon_container android.view.ViewGroup A container to hold car_ui_toolbar_logo and car_ui_toolbar_nav_icon.
car_ui_toolbar_menu_items_container android.view.ViewGroup A ViewGroup to contain MenuItems.
car_ui_toolbar_title android.widget.TextView The title of the toolbar.
car_ui_toolbar_title_logo_container android.view.ViewGroup A container for the car_ui_toolbar_title_logo. The container will be displayed (or hidden) instead of the ImageView.
car_ui_toolbar_title_logo android.widget.ImageView The logo, when car_ui_toolbar_logo_
fills_nav_icon_space is false
car_ui_toolbar_search_view_container android.widget.FrameLayout A container into which the search view is to be inflated. This reduces inflation durations on screens without Search bars.
car_ui_toolbar_progress_bar android.widget.ProgressBar A progress bar.

Next, you must also customize car_ui_toolbar_search_view.xml, which contains the Search bar, which must have the following views:

id View type Description
car_ui_toolbar_search_bar android.widget.EditText The EditText where the user types text to search.
car_ui_toolbar_search_icon android.widget.ImageView An icon, that normally shows a search icon but can be changed by applications.
car_ui_toolbar_search_close android.view.View A view that when clicked will clear the search box

In addition to the layout, you can use these Boolean attributes to customize the toolbar:

Attribute Description
car_ui_toolbar_tabs_on_second_row Determines whether or not to hide the title when tabs are displayed.
car_ui_toolbar_nav_icon_reserve_space Determines if the title should be moved to the left to occupy the space of the Navigation icon when the Navigation icon is hidden.
car_ui_toolbar_logo_fills_nav_icon_space Display the logo in the same space as the Navigation button when no Navigation button is present.
car_ui_toolbar_show_logo To permanently disable the display of a logo in the toolbar, set this to false.

These views are displayed, hidden, or changed based on the setState of the ToolbarControllerImpl method. For specifics about which view is displayed and when, see that method.