我有一个应用程序,它的操作栏包含 1)向上按钮打开侧边栏导航菜单就像谷歌加 2) 2个操作菜单按钮 3) 2个标签通过view pager实现
我已经使用 actionbarsherlock 成功实现了 actionbar,结果是 ->
我想实现类似 evernote 应用程序的东西,其中向上按钮和选项卡在一行中,操作菜单使用 split actionbar 。我有标签图标,所以将它们与向上按钮排成一行不是问题
有人可以给我指出正确的方向,关于如何通过修改 actionbarsherlock lib 使向上按钮与选项卡位于同一水平栏中。
谢谢
最佳答案
//启用嵌入式标签
//pre-ICS
if (actionBarSherlock instanceof ActionBarImpl) {
enableEmbeddedTabs(actionBarSherlock);
//ICS and forward
} else if (actionBarSherlock instanceof ActionBarWrapper) {
try {
Field actionBarField = actionBarSherlock.getClass().getDeclaredField("mActionBar");
actionBarField.setAccessible(true);
enableEmbeddedTabs(actionBarField.get(actionBarSherlock));
} catch (Exception e) {
Log.e(TAG, "Error enabling embedded tabs", e);
}
}
//helper method
private void enableEmbeddedTabs(Object actionBar) {
try {
Method setHasEmbeddedTabsMethod = actionBar.getClass().getDeclaredMethod("setHasEmbeddedTabs", boolean.class);
setHasEmbeddedTabsMethod.setAccessible(true);
setHasEmbeddedTabsMethod.invoke(actionBar, true);
} catch (Exception e) {
Log.e(TAG, "Error marking actionbar embedded", e);
}
}
进一步引用 - https://groups.google.com/forum/#!topic/actionbarsherlock/hmmB1JqDeCk
关于android - 类似 evernote 的操作栏 - 向上按钮和选项卡在顶部的一行中,菜单操作在底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12761218/