2010-10-21 50 views
0

我正在使用TabHost和TabWidget爲Android應用程序創建一些選項卡。我發現標籤垂直顯示出來。有什麼辦法可以製作水平對齊的標籤(一個在另一個之上)?是否可以在Android OS中創建水平製表符?

我創建的標籤是這樣的:

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <TabWidget 
     android:id="@android:id/tabs" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"/> 
    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
     <TextView 
      android:id="@+id/textview1" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:text="this is a tab" /> 
     <TextView 
      android:id="@+id/textview2" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:text="this is another tab" />    
    </FrameLayout> 
</LinearLayout> 

像這樣的東西是什麼,我需要做的:

alt text

+0

我實際上在這一天搞砸了,我無法得到任何有用的東西。問題是tabwidget。所有的tabwidget都是線性佈局。所以你可以繼承線性佈局來自己做。 – Falmarri 2010-10-21 20:58:16

回答

1

我不確定,但我認爲你可以用默認行爲做很多事情。總的來說,Android的標籤支持對我來說似乎有點笨拙。但讓我知道如果你確實得到這個工作 - 我可能會自己使用它!

FWIW,我做了我自己的選項卡行爲使用圖像按鈕和其他控制元素。就我而言,我試圖想出那些沒有使用太多屏幕房地產的選項卡。

相關問題