質問

フラグメント化能の私のレイアウトに断片塊を持っています。

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/llDetector"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@+id/realtabcontent"
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="1" />

        <android.support.v4.app.FragmentTabHost
            android:id="@android:id/tabhost"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >
    <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="0dp"
                android:layout_height="0dp"
                android:layout_weight="0" />
        </android.support.v4.app.FragmentTabHost>

    </LinearLayout>
.

ENTER IMENTDESCRUストの入力

それはうまく機能していますが、タブストリップがTabWidgetの上部にあるようにしたいです。どうやってそれを達成することができますか?事前にありがとう!

役に立ちましたか?

解決

大丈夫私は私の道をやりました!

私がしたことは私のtabwidgetのレイアウトを膨張させ、それを私のfragmenttabhostに追加することです、

これと同じように:

View vTab = LayoutInflater.from(this).inflate(R.layout.tab_icon,    null, false);
mainTabhost.addTab(mainTabhost.newTabSpec("tab1").setIndicator(vTab),   Fragment_Sample.class, null);
.

およびMy Tab_ICON XMLファイル:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="3dp"
        android:background="@drawable/tab_icon_selector_inverse"
        android:textColor="@color/white" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/tab_icon_selector"
        android:drawableTop="@drawable/ic_icons"
        android:gravity="center"
        android:paddingBottom="5dp"
        android:paddingTop="5dp"
        android:text="@string/static_tab_whats_up"
        android:textColor="@color/white"
        android:textSize="11sp" />

</LinearLayout>
.

場合もこれも必要です。これは助けになるでしょう。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top