2011-12-15 10 views
0

とアンドロイド。 このレイアウトのTABアイコン(TabWidget)が画面上に表示されないという問題があります。私はそれがフレームレイアウトのfill_parentのためだと思います。 私はそれが ボタン タブ TabWidgetTabhostは、私は次のようなレイアウトを持っている固定ヘッダ

ようにする必要があります(それは他の機器で使用するために良いではありませんので...)しかし、私は

がどのように修正することができ、固定サイズを定義する必要はありません

編集:私は問題を発見した 、新しいXMLは、この程度

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/show_recipe_bg"> 

    <Button 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:id="@+id/saveRecipeButtonId" 
     android:text="@string/save_recipe_button" 
     android:layout_gravity="center" /> 

    <TabHost 
     android:id="@android:id/tabhost" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="5dp"> 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:padding="5dp" /> 

      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom" /> 
     </LinearLayout> 
    </TabHost> 
</LinearLayout> 

Android: Tabs at the BOTTOM

答えて

0

方法です。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 
<TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> 
    <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent" android:orientation="vertical"> 
     <TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget> 
     <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent"> 
      <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab1"></LinearLayout> 
      <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab2"></LinearLayout> 
      <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/tab3"></LinearLayout> 
     </FrameLayout> 
    </LinearLayout> 
</TabHost> 

+0

Hmmmmmはそれについて考えなかった - 試してみる。ありがとう – Yoav

+0

まだ良くありません - TABSは画面の裏にあるので消えます。 – Yoav

0

2つの方法があります:

  1. @sampathpremarathna答えに記載されている - ちょうど階層内までButtonを移動し、TabHost

  2. あなたのレベルにLinearLayoutRelativeLayoutに変更しようとして、それをFrameLayoutと定義することができますldはボタンの下、そして上のタブです。

+0

問題は、TABアイコンがレイアウトの背景にあることです。 match_parentを使用すると、タブのフレームが画面に表示され、TABが画面外にある – Yoav

+0

2番目の解決策では、相対レイアウトで、アンドロイド.alignParentRight'、アンドロイド.alignParentLeft'、アンドロイド.above'、 android.below'あなたが 'width'または' height'パラメータに何を書き込んでも無視されます – Jin35

関連する問題