Difference between ActionBarSherlock and ActionBar Compatibility

后端 未结 7 1893
庸人自扰
庸人自扰 2020-11-28 00:39

What is the difference between ActionBarSherlock and Action Bar Compatibility

Fews days ago Google just released the ActionBar Compatibility that make me so confused

7条回答
  •  青春惊慌失措
    2020-11-28 01:08

    Actionbar Sherlock is far more advanced and far more ambitious than the simple Actionbar compatibility project.

    The Action bar compatibility can be considered a "sample" or a good starting point if you only want to smack an Action Bar on top of your app.

    ActionBarSherlock builds on the compatibility library, and gives you (like the action bar compatibility sample) an Action Bar on pre-3.0 devices. In addition it has extra features not present in the ActionBar Compat code. This includes features like, but not limited to

    • setNavigationMode (for Tabs and spinners in the action bar)
    • Dialog Fragments
    • Contextual Action Bar (CAB) a menu that takes over the action bar, used for example for multi select (http://developer.android.com/design/patterns/new-4-0.html) This is a ICS feature (!) For this, an implementation of the ActionMode class (introduced in API level 11) had to be introduced into the ActionbarSherlock library
    • Fragment and FragmentActivity implementations - because fragments can implement the onCreateOptions menu, we need to make sure that the SupportMenuInflater is used.
    • Two themes not very unlike Holo.Dark and Holo.Light (Theme.Sherlock, Theme.Sherlock.Light)
    • The ICS feature "split action bar"

    The only downside I see in using ActionbarSherlock is that you lock yourself in to that library. If for some reason it will die out in the near future, you'll have to maintain it youself (for example if no Jellybean implementation comes along). This is a hassle (not a huge problem) since all your fragments extends SherlockFragemnt and all your Activities. SherlockActivity.

提交回复
热议问题