在ActionBarSherlock 4实施标签问题 [英] Problems implementing tabs in ActionBarSherlock 4
问题描述
我真的很想得到这个工作,但我觉得我一直在挣扎有关小时。我开始了一个新的应用程序,并希望尝试按照UI指南尽可能接近,这对于下面冰淇淋三明治什么似乎意味着我需要使用ActionBarSherlock。纵观例如这里它看起来像它应该是简单的。
I really want to get this to work, but I feel like I've been floundering about for hours. I'm starting up a new app and want to try to follow the UI guidelines as close as possible, which for anything below ice-cream sandwich seems to mean I need to use ActionBarSherlock. Looking at the example here it looks like it should be straightforward.
我试图实现它,这是行不通的,因为FragmentActivity没有getSupportActionBar()方法。
I try to implement it and it doesn't work because FragmentActivity does not have a getSupportActionBar() method.
纵观的<一个href="https://github.com/JakeWharton/ActionBarSherlock/tree/4.0-wip/samples/demos/src/com/actionbarsherlock/sample/demos">demo应用,似乎他们不使用FragmentActivity,他们使用SherlockActivity。那么,SherlockActivity确实有getSupportActionBar()方法,所以这是有希望的。继续与这个例子了一会儿......
Taking a look at the demo app and it seems they don't use FragmentActivity, they use SherlockActivity. Well, SherlockActivity does have a getSupportActionBar() method, so that's promising. Continuing on with the example for a while...
好了,现在看来com.actionbarsherlock.app.ActionBar.TabListener没有通过FragmentTransaction其事件?不仅如此,但SherlockActivity不具有getSupportFragmentManager()方法...
Okay, now it seems the com.actionbarsherlock.app.ActionBar.TabListener doesn't pass FragmentTransaction to its events? Not only that, but the SherlockActivity doesn't have a getSupportFragmentManager() method...
上午我(希望)只是在做一些完全错误的?如何保持遇到所有这些问题,没有人是?我觉得我要疯了这里。唯一可能相关的问题,我发现是<一个href="http://groups.google.com/group/actionbarsherlock/browse_thread/thread/2469f6b37fdf68e4">here这不是非常有用的。
Am I (hopefully) just doing something completely wrong? How do I keep encountering all these issues that no one else is? I feel like I'm going nuts here. The only potentially related issue I've found is here and it's not very useful.
推荐答案
您需要从SherlockFragmentActivity而不只是SherlockActivity或SherlockFragment延伸。这样,您将获得ABS和片段支持。
You need to extend from SherlockFragmentActivity instead of only SherlockActivity or SherlockFragment. This way you will get access to ABS and the Fragment Support.
这篇关于在ActionBarSherlock 4实施标签问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!