2013-01-17 55 views
7

我同意任何想讓選項卡應該位於屏幕頂部的參數的任何人,但我無法控制我的應用程序的要求:)。我必須在屏幕底部製作帶有標籤的應用程序。我正在使用SDK 14和ActionBars。這甚至有可能嗎?我已經使用底部的選項卡構建了一個佈局,但是當我將選項卡添加到ActionBar時,它們會自動呈現在屏幕的頂部。屏幕底部的Android操作欄選項卡

任何想法將非常感激,並感謝大家花時間閱讀這篇文章。

+0

您需要使用ActionBar作爲製表符還是可以使用TabHost? – MCeley

+0

我不確定哪條路線更好。因爲這是開發人員指南的建議,所以我開始使用ActionBar。我也在SDK 14上。我開始考慮使用TabHost。是否可以使用TabHost將標籤放置在底部? – user1956604

+0

是的,您可以使用TabHost將它們放在底部。 – MCeley

回答

1

您可以使用Tabhost作爲需求,在tab.xml中您可以編寫下面的代碼。這將工作正常。

<?xml version="1.0" encoding="UTF-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/tabhost" android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <RelativeLayout android:orientation="vertical" 
     android:layout_width="fill_parent" android:layout_height="fill_parent"> 
     <FrameLayout android:id="@android:id/tabcontent" 
      android:layout_width="fill_parent" android:layout_height="fill_parent" 
      android:layout_weight="1" > 
       </FrameLayout> 
      <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" android:layout_height="wrap_content" 
      android:tabStripEnabled="false" 
      android:layout_alignBottom="@android:id/tabcontent" 
      android:background="#000000" /> 
      </RelativeLayout> 
</TabHost> 
相關問題