2012-07-22 80 views
1

嗯,這是我的main.xml其中包含tabhost:horizo​​ntall滾動視圖不起作用,或者讓我的內容消失

問題是,滾動型水平不列入工作。如果我將相對佈局更改爲linearlayout選項卡可滾動,但我看不到主要內容od我的活動 - 我只看到選項卡。

我也嘗試完全刪除包含tabwidget但沒有任何更改的線性佈局。

如果您需要任何其他xml讓我知道。

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" 
    android:paddingTop="@dimen/tab_space_top" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
    <RelativeLayout android:id="@+id/tab_relative_layout" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     > 
     <HorizontalScrollView android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:fillViewport="true" 
       android:scrollbars="none"> 
       <LinearLayout android:id="@+id/tab_linear_layout" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 
     <TabWidget android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 
      </TabWidget> 
      </LinearLayout> 
      </HorizontalScrollView> 
     <FrameLayout android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_below="@android:id/tabs"> 

     </FrameLayout> 

    </RelativeLayout> 
</TabHost> 

有幫助嗎?

+1

似乎你的xml有一些額外的東西,也許給[this](http://blog.uncommons.org/2011/04/18/scrolling-tabs-in-android/)一試? – dmon 2012-07-22 13:57:35

+0

感謝它的工作!讓它成爲答案,我可以接受它! – ghostrider 2012-07-22 14:03:36

回答

相關問題