问题标签 [actionbarsherlock]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
5988 浏览

android - Greendroid 或 ActionbarSherlock - 设置

你们知道任何关于如何在 Windows 上的 Eclipse 中使用上述框架之一的教程吗?我已经下载了它们并按照说明进行操作 - 但在这两种情况下我仍然遇到错误。沮丧。

0 投票
3 回答
3276 浏览

android - ActionBar Sherlock - 操作栏中的背景图像

我很想为我使用“ActionBar Sherlock”库导入的 ActionBar 设置一个 Backgroundimage。但是,我在互联网上找不到任何关于如何使用 XML 明确设置 BackgroundImage 的链接。

这里有没有人有他可以给我的提示:)?

0 投票
5 回答
12347 浏览

android - 使用选项卡在 ActionBar 中调用了太多次 onCreateOptionsMenu

这是我的问题。我有一个应用程序,我在其中使用带有选项卡的 ActionBar Sherlock、带有选项菜单的片段。每次我旋转模拟器时,都会为所有片段添加菜单,即使是那些被隐藏/删除的片段(我都试过了)。

这是设置:一个 FragmentActivity,它有一个带有 ActionBar 的

这些选项卡都使用相同的侦听器:

FragmentListBase 的每个子类都有自己的菜单,因此所有 3 个子类都有:

和适当的

当我运行应用程序时,我可以看到 onCreateOptionsMenu 被多次调用,用于所有不同的片段。

我完全被难住了。

我尝试发布尽可能多的代码而不是压倒性的,如果您发现缺少某些内容,请告知。

[编辑] 我添加了更多的日志记录,结果证明片段在旋转时被附加了两次(或更多)。我注意到的一件事是,除了只调用一次的 onCreate() 方法之外,所有内容都被多次调用。

[编辑 2]

好的,我开始追溯 Android 代码并在这里找到了这部分(我为缩短这篇文章而进行了编辑)。

/com_actionbarsherlock/src/android/support/v4/app/FragmentManager.java

问题是 mAdded 确实在其中有多个 FragmentList1 实例,因此 onCreateOptionsMenu() 方法被“正确”调用了 3 次,但是对于 FragmentList1 类的不同实例。我不明白为什么要多次添加该课程……但这是一个很好的线索。

0 投票
1 回答
2989 浏览

android - 在 FragmentTabPager 中的 TabHost 内向 Fragment 发送消息

我正在使用 FragmentTabsPager 类

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabsPager.html

在我的一个应用程序中。FragmentTabsPager 包含 3 个片段。在我的布局中,左侧有一个列表,我想向 FragmentTabsPager 中的当前 Fragment 发送消息 (onListItemClick)。我很难在寻呼机中获取当前的 Fragment 实例。

对不起,我知道这很模糊,但如果有人有一个很棒的想法。

从 List 片段传递消息的机制很好,我可以将消息放入我的 FragmentTabsPager 类没有问题。它将消息传递到 TabHost 中的当前片段中,这给我带来了压力。

0 投票
14 回答
60098 浏览

android - Android:getSupportActionBar() 在 ActionBarSherlock 库中总是返回 null

我正在尝试使用ActionBarSherlock库为我的 Android 应用程序中的选项卡提供向后兼容的 ActionBar 支持,因此我下载了最新版本,构建了演示并运行了它。

如果你去操作栏,然后选择标签导航,它每次都会崩溃。这是堆栈跟踪:

在解决此问题之前,我无法继续使用我的应用程序。我写了一堆代码,在我的应用程序中设置了操作栏,并尝试运行它,但由于getSupportActionBar()调用时返回 null 值,它与 NPE 一起崩溃。

相关代码实际上在库的演示中:

0 投票
6 回答
5162 浏览

android - 有没有办法在一个项目中使用 Roboguice 和 ActionbarSherlock?

我想在一个项目中使用标题中提到的库。

但是,两者都需要我的活动从一个特殊的活动类扩展:对于 Roboguice,它是 RoboAcitivity,它是 ActionbarSherlock 的 FragmentActivity。

ActionbarSherlock 扩展了兼容性库,很好,因为我还需要使用片段,并且项目级别 s < API 级别 11。

有没有人成功做到这一点?由于Java不支持多重继承(这通常是一件好事),所以我尝试在ActionbarSherlock项目中制作FragmentActivity来扩展RoboActivity而不是标准Activity。但我不能让它以这种方式编译。

控制台输出的一部分是:

0 投票
1 回答
652 浏览

android - Can't compile with Android Library Projects

I have two Android Library Projects in Eclipse (yes, "Is library" is selected in both of them). One of those is ActionBarSherlock, the other one is ViewPagerIndicator

Now, ViewPagerIndicator must include ActionBarSherlock as a library dependence, so I add it under the "Android" settings of the project. Problem is, in the moment I add the library dependence, if I go to Java Build Path of the same project I can see that the dependence .jar of the added library is required but not present (of course, as it is a library project, no jars are created!).

What can be the problem? Furthermore, I have to add both libraries as dependences to an Android application, which presents the same issue.

0 投票
7 回答
44410 浏览

java - ActionBarSherlock 和 ActionBar 兼容性的区别

ActionBarSherlockAction Bar 兼容性有什么区别

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

示例: Action Bar Compatibility 中是否支持“向上”导航的应用程序图标或 ActionBar.Tab?

0 投票
2 回答
1498 浏览

android - 使用 ActionBarSherlock 时选项菜单不会动态更新

我需要什么:创建一个带有“登录”选项的选项菜单,当用户登录时,当用户再次点击菜单按钮时,它需要更改为“退出”

使用纯 SDK 时,我可以只更改 onPrepareOptionsMenu 中的菜单选项,使用兼容性库 v4 时相同,但是使用 ActionBarSherlock 时,菜单不会在 onPrepareOptionsMenu 中更新;它仍然被调用,但显示的菜单没有改变。

有人对此有解决方案吗?

0 投票
4 回答
18488 浏览

android - 操作栏中的自定义主页图标 Sherlock

我正在尝试使用ActionBarSherlock 库为主页图标设置自定义图标。我试图abHomeLayout在我的自定义主题中使用属性设置自定义布局。但这对我不起作用。唯一的方法,如何设置它,是abIcon为我的自定义drawble设置属性,但我不能为这个drawable设置一些水平填充。有没有这方面的例子,或者abHomeLayout属性可能在哪里出现问题?