java - ActionBarSherlock 和 ActionBar 兼容性的区别

标签 java android actionbarsherlock android-actionbar android-actionbar-compat

ActionBarSherlock 和有什么区别?和 Action Bar Compatibility

几天前,谷歌刚刚发布了让我很困惑的 ActionBar 兼容性。 Action Bar Compatibility 是否与 ActionBarSherlock 的工作方式相同并且编码是否相同?

示例:是否 app icon to navigate "up"或 Action Bar Compatibility 支持 ActionBar.Tab 吗?

最佳答案

ActionBarSherlock 与 ActionBarCompat:

我只想在 ActionBarSherlock 与 ActionBarCompat Lib 之间放置一些代码差异

 ActionBarSherlock vs ActionBarCompat **strong text**

我们可以将一些应用从 ActionBarSherlock 迁移到 ActionBarCompat:

步骤:

  1. 导入 AppCompat 项目。

  2. SherlockFragmentActivity 替换为 ActionBarActivity

  3. SherlockFragment 替换为 Fragment

  4. 更改 MenuMenuItemgetSupportMenuInflater() 引用. 修改获取 Action View 的方式。

    mSearchView = (SearchView)MenuItemCompat.getActionView(mSearchItem)

  5. 修改您的主题样式

如需更多信息,请参阅 +NickButcher 提供的幻灯片(谷歌)

enter image description here

感谢来源: http://gmariotti.blogspot.in/2013/07/actionbarsherlock-vs-actionbarcompat.html http://antonioleiva.com/actionbarcompat-migrating-actionbarsherlock/

别忘了阅读这篇 developer.android了解更多关于 ABC 的信息!

注意:不幸的是,支持库无法像 ABS 一样为单元测试设置它。

输出:

enter image description here

致谢:加布里埃尔·马里奥蒂

关于java - ActionBarSherlock 和 ActionBar 兼容性的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7844517/

相关文章:

java - xtext生成器如何防止文件覆盖

java - "has private access"泛型错误

android - 使用 Realm 数据库检查两个字段

android - 项目菜单操作栏 sherlock 的图像

java - (Android Studio) (Java) 使用 A 类中的 ArrayList 在 B 类中构建的方法时遇到问题

java - 最后一个数据包成功发送到服务器是在 > 70,400,003 毫秒之前。比服务器配置的长

android - Fabric ListView 中的 Twitter 用户时间线

java - 知道为什么我的 getColumnIndex() 通过 android 返回 -1 吗?

android - 夏洛克操作栏菜单

android - ActionbarSherlock SearchView 未在 onCloseListener 中关闭