12

私のアプリには 4 つのタブを持つタブホストがあり、現在、横向きモード用の素敵なレイアウトを作成しようとしています。追加の水平スペースを利用するために、TabWidget を画面の右側に配置したいと考えています。もちろん、すべてのタブは (列のように) 1 つ下に配置する必要があります。しかし、ランドスケープ モードに切り替えると、すべてのタブが一列に並んで表示され、見栄えが悪くなります。それを修正する方法は?

スクリーンショット

<?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" >
    <LinearLayout

        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
        >

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1">

            <include layout="@layout/filter_wizard"/>
            <include layout="@layout/filter_wizard"/>
            <include layout="@layout/filter_wizard"/>
            <include layout="@layout/filter_wizard"/>

            </FrameLayout>

             <TabWidget
            android:background="#75ffffff"
            android:id="@android:id/tabs"
            android:layout_width="wrap_content" android:orientation="vertical" 
            android:layout_height="fill_parent" android:layout_weight="0" />



    </LinearLayout>
</TabHost>
4

4 に答える 4

4

TabHost は orientation 属性をサポートしておらず、タブは水平方向にのみ使用できます。

于 2010-11-11T05:39:00.927 に答える
3

したがって、あなたがしなければならない唯一の重要な考えはこれです:

getTabWidget().setOrientation(LinearLayout.VERTICAL);

メソッドTabWidgetにハードコーディングさsetOrientation(LinearLayout.HORIZONTAL);れているためです。initTabWidget()どうしてか分かりません。

于 2011-04-25T14:14:56.980 に答える
0

ここに、垂直タブ配置ビューの似たようなソリューションがあります

このリンクにアクセスしてください:-クリックイベントでフレームレイアウトのレイアウトを変更するには?

ありがとうHapppieeeeコーディング

于 2014-10-02T11:52:02.087 に答える