2012-03-22 2 views
0

私はタブを作成するために使用したいクラスを作成しました(私はアクティビティを使いたくありません)。さて、私のtabs.xmlファイルが含まれています:TabHostにTabWidgetとFrameLayoutを手動で追加するにはどうしたらいいですか?

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

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

    <TabWidget 
     android:id="@+id/tabs"     //Not @android:id="@android:id/tabs 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" /> 

    <FrameLayout 
     android:id="@+id/tabcontent"   //[email protected]:id="@android:id/tabcontent 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

     <include 
      android:id="@+id/tab_horizontal_scroll" layout="@layout/gallerymodule"/> 

    </FrameLayout> 

</LinearLayout> 

</TabHost> 

私はTabHostオブジェクトはTabWidgetとでframeLayoutへの参照を取得していないことを理解しています。

これらの参照を手動で追加する方法を知りたいですか?ありがとう。

答えて

0

here

おかげで...

+1

がそれを手に入れた..私は、これはあなたを助けるだろうと思い、このリンクを参照してください!!使用されたandroid:Tab/Tabでのid /タブと、参照を取得するためのandroid:id/tabcontent in FrameLayout問題はTabHost.setup()を使わなかったことです。 – FireAndIce

関連する問題