如何在屏幕的下半部分显示一个Tabhost,显示静态图片(每次刷卡时都不能重新加载/重新显示)。
+--------------------------+---+---+
| = | * | ? | < Action Bar with Help, Settings and
+--------------------------+---+---+ a sliding drawer from the left
| | should be present.
| |
| |
| static | < This should, regardless of the tab
| picture/map | < selected, be the same.
| |
| |
| |
+----------------------------------+
| TAB1 | TAB2 | TAB3 | TAB4 | TAB5 | < There will be about 20 Tabs, if
+----------------------------------+ that is of any relevance
| |
| TEXTTEXTTEXTTEXTTEXTTEXT | < Only the Text should, depending on
| TEXTTEXTTEXTTEXTTEXTTEXT | < the selected Tab, be switched
| TEXTTEXTTEXTTEXTTEXTTEXT | < accordingly.
| TEXTTEXTTEXTTEXTTEXTTEXT |
| |
+----------------------------------+
如果无法做到这一点,我可以使用什么?我是TextSwitcher的负责人,但这并没有像tabHost那样持续不断的滑动动画。
非常感谢。
答案 0 :(得分:0)
执行此操作的一种方法是在Fragment
中有两个垂直定位的Activity
,如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment android:name="com.whatever.ImageFragment"
android:id="@+id/image_fragment"
android:layout_weight="1"
android:layout_height="0dp"
android:layout_width="match_parent" />
<fragment android:name="com.whatever.TabHostFragment"
android:id="@+id/tabhost_fragment"
android:layout_weight="2"
android:layout_height="0dp"
android:layout_width="match_parent" />
</LinearLayout>
顶部Fragment
将包含MapView
或ImageView
,而底部片段将包含FragmentTabHost
,文本为Fragment
。请注意,在这种情况下,FragmentTabHost
将被强制使用getChildFragmentManager()
方法获取文本Fragment
。