简体   繁体   中英

What is the best practice/way to implement Toolbar in android apps Toolbar as Action Bar or Standalone Toolbar?

Android的新工具栏小部件类可以实现为操作栏或独立工具栏。我对哪种方法更快,建议使用的方法感到困惑。

Well first I would like to say

A Toolbar is a generalization of ActionBars for use within application layouts. While an action bar is traditionally part of an Activity's opaque window decor controlled by the framework.

and I think you know all that already

and then the most importance feature

A Toolbar may be placed at any arbitrary level of nesting within a view hierarchy.

both way performance would be same but the thing is standalone Toolbar will be move able inside the view hierarchy so it all depends on what you wanna do with it if you need it just as action bar then use it as action bar and if you want to move it around like in AppbarLayout etc then set it as Toolbar.

Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM