[英]FragmentActivity TabHost with Fragment and Activity
I have to implement such diagram-hierarchy in my application. 我必须在我的应用程序中实现这样的图层次结构。
I have got 5 tabs from TabHost
. 我有
TabHost
5个标签。 One of them should be Activity
cause of specific behaviour. 其中一个应该是特定行为的
Activity
原因。 This only one Activity should have both: landscape and portrait orientation, but Fragments
should have only one (portrait). 这只有一个活动应该同时具有: 横向和纵向 ,但
Fragments
应该只有一个(纵向)。
Every portrait layout should have tabs below, but this one Activity shouldn't. 每个肖像布局都应该有下面的标签,但这一个活动不应该。 I managed do accomplish it with 5 fragments inside
TabHost
, but I found out, that I can do that only with one Activity and 4 Fragments, or with all 5 Activities. 我管理完成了
TabHost
5个片段,但我发现,我只能使用一个Activity和4个片段,或者所有5个活动。
It won't be a problem to have 5 activities (FragmentActivities), but I prefer to have Fragments. 有5个活动(FragmentActivities)不会有问题,但我更喜欢有片段。 I think, that i should extend
FragmentActivity
and TabActivity
in MyTabActivity
(it is Activity with TabHost), but I cannot extend two classes in JAVA. 我想,我应该在
MyTabActivity
扩展FragmentActivity
和TabActivity
(它是带有MyTabActivity
Activity),但是我不能在JAVA中扩展两个类。 Unlucky there's no such class like TabFragmentActivity
:-) 不幸的是没有
TabFragmentActivity
这样的课程:-)
So my question: is it possible to obtain such effect like in the diagram above ? 所以我的问题是: 是否有可能获得如上图所示的效果 ?
PS Maybe I'm missing sth important, cause I have just started with Java/Android - it could be a clue. PS也许我错过了很重要,因为我刚刚开始使用Java / Android - 它可能是一个线索。
You have a solution to solve your problem here: http://droidapp.co.uk/2012/05/25/android-dev-actionbarsherlock-tabs-viewpager/ and here the source code: https://bitbucket.org/owentech/abstabsviewpager/ 你有一个解决方案来解决你的问题: http : //droidapp.co.uk/2012/05/25/android-dev-actionbarsherlock-tabs-viewpager/这里的源代码: https : //bitbucket.org/ owentech / abstabsviewpager /
wich is 是的
It's a tutorial to work with actionbar, tabs, viewpager and fragments...and supporting >2.3, so it seems to solve all your needs. 这是一个使用actionbar,tabs,viewpager和fragment ...以及支持> 2.3的教程,因此它似乎可以解决您的所有需求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.