Difference between ActionBarSherlock and ActionBar Compatibility

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

    ActionBarSherlock vs ActionBarCompat:

    I Just want to put few code difference between ActionBarSherlock vs ActionBarCompat Lib

     ActionBarSherlock vs ActionBarCompat **strong text**

    We can migrate some apps from ActionBarSherlock to ActionBarCompat:

    steps:

    1. Import AppCompat project.

    2. Replace SherlockFragmentActivity with ActionBarActivity.

    3. Replace SherlockFragment with Fragment.

    4. Change Menu, MenuItem and getSupportMenuInflater() references. Modify the way you get Action Views.

      mSearchView = (SearchView)MenuItemCompat.getActionView(mSearchItem)

    5. Modify your Themes and Styles.

    For more info, please refer this slides by +NickButcher (Google)

    enter image description here

    Thanks to Sources: http://gmariotti.blogspot.in/2013/07/actionbarsherlock-vs-actionbarcompat.html http://antonioleiva.com/actionbarcompat-migrating-actionbarsherlock/

    Don't forget to read this developer.android for more about ABC!

    Note: Setting it up for unit tests the same way as ABS is unfortunately not possible with the support library.

    Output:

    enter image description here

    Credits: Gabriele Mariotti

提交回复
热议问题