Should we replace Action Bar by ToolBar?

后端 未结 10 1511
日久生厌
日久生厌 2020-12-12 19:11

I have been using ToolBar since it was added into Support v7 library. And I think I used it well. But there is a point I can\'t understand. Why

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-12 19:45

    Why have we to use ToolBar?

    Toolbar is use for pre-devices and backport compatibility that the old support library does not provide. Remember ActionbarSherlock, android made there own to support actionbar on low level API devices.

    What are advantages of ToolBar over ActionBar if any?

    You can easy add custom view with in the XML of toolbar like a relative layout view, specially a custom title and icons with animations. You have more control on your toolbar rather than the old conventional actionbar.

    Is it necessary to replace ActionBar by ToolBar?

    If you are going to support actionbar on devices lower than 2.0 then yes, you need a back-port compatibility for action bar.

提交回复
热议问题