2015-02-09 35 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。