For the More Curious: Action Bar vs Toolbar

Figure 13.13  Action Bar vs Toolbar

Set of two screenshots are shown.

What is the difference between the action bar and the toolbar?

The most obvious difference is the updated visual design of the toolbar. The toolbar no longer includes an icon on the left side and decreases some of the spacing between the action items on the right side. Another major visual change is the Up button. In the action bar, this button was much more subtle and was just an accessory next to the icon in the action bar.

Aside from the visual differences, the main goal of the toolbar is to be more flexible than the action bar. The action bar has many constraints. It will always appear at the top of the screen. There can only be one action bar. The size of the action bar is fixed and should not be changed. The toolbar does not have these constraints.

In this chapter, you used a toolbar that was provided by one of the AppCompat themes. Alternatively, you can manually include a toolbar as a normal view in your activity or fragment’s layout file. You can place this toolbar anywhere you like and you can even include multiple toolbars on the screen at the same time. This flexibility allows for interesting designs; for example, imagine if each fragment that you use maintains its own toolbar. When you host multiple fragments on the screen at the same time, each of them can bring along its own toolbar instead of sharing a single toolbar at the top of the screen.

Another interesting addition with the toolbar is the ability to place Views inside of the toolbar and to also adjust the height of the toolbar. This allows for much more flexibility in the way that your app works.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
34.227.112.145