2015-02-09 70 views
1

我如何在屏幕的下半部分显示一个Tabhost,显示一张静态图片(每次刷卡时都不能重新加载/重新显示)。半屏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

一种方法是将有两个垂直放置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将持有MapViewImageView,底部片段将包含FragmentTabHost与文本Fragment s。请注意,在这种情况下,FragmentTabHost将被迫使用getChildFragmentManager()方法获取文本Fragment s。