Difference between ActionBarSherlock and ActionBar Compatibility

后端 未结 7 1898
庸人自扰
庸人自扰 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:14

    Well @Jake implementation goes way further than what the Actionbar compat, to be more precise Actionbar Compat is just a basic example on how can you support all aplication with a pseudo-actionbar for releases prior from Honeycomb (API 13). Although their target is the same cross compatible actionbar, they have diferent approach.

    ActionbarCompat Aproach

    This implementation make no use of the Compatibility Android support library instead it create a base class called ActionBarActivity create a single instance of a Helper this helper act as factory itself that returns diferent implementation for the three segment of APIS, it returns

    • ActionbarBaseHelper: for prior to HoneyComb.
    • ActionBarHoneyComb: for HoneyComb
    • ActionBarHelperICS: for ICS base devices.

    The most interesting part is in the ActionbarBaseHelper, because it has the most important code, I suggest you understand this class and you will get the whole example.

    Action Bar Sherlock

    Well this is tricky firstable because, I'm not the author maybe Jake can explained further this, but I'll give it a try.

    Just as the compat Sherlock make diferent implementation but one is for "Compat" and the other is Native. It force you to extends either from SherlockActivity or from SherlockFragmentActivity, because this two base classes have the method for dispatching the ActionBar.

    This is a large and complex project, that cannot be explained in a single post. Suggest you dig around Sherlock Github repo grab a look and as Jeff Atwood says

    enter image description here

提交回复
热议问题