半屏TabHost
Half-screen TabHost
如何在屏幕下半部分显示一个Tabhost,显示静态图片(每次滑动都不能reloaded/redisplayed)
+--------------------------+---+---+
| = | * | ? | < 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 的漂亮的连续滑动动画。
非常感谢。
一种方法是在您的 Activity
中垂直放置两个 Fragment
,如下所示:
<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
s.
如何在屏幕下半部分显示一个Tabhost,显示静态图片(每次滑动都不能reloaded/redisplayed)
+--------------------------+---+---+
| = | * | ? | < 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 的漂亮的连续滑动动画。
非常感谢。
一种方法是在您的 Activity
中垂直放置两个 Fragment
,如下所示:
<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
s.