私は単純なフラグが必要だと確信していますが、正しい解決策を見つけるのに少なくとも2時間かかっています。あなたからの助けを得ることを願っています。 fragmentActivityを使用して2つのタブレイアウトを作成しようとしています。私は各タブに50%のスクリーンスペースを与えたいと思っています。私は次のハードルが、私はタブのヘッダーが欲しいです(添付のスクリーンショットを参照してください)を行うことができます。黒bkgでの財政は50%、残りはゲイリーbkgで残りの50%を取る必要があります。 フラグメントタブのヘッダー/ラベルのサイズ
私は私の質問で明確です。 :-)
attaching my 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"
android:background="#EFEFEF" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/financial"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"
android:tag="@string/financial" />
<FrameLayout
android:id="@+id/other"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:tag="@string/others" />
</FrameLayout>
</RelativeLayout>
</TabHost>
**The calling xml would be**
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="48dp"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1" >
</ListView>
<fragment
class="com.......android.activity.AccountsTab"
android:id="@+id/tabs_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"/>
</RelativeLayout>
tab.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="150dp"
android:layout_height="@dimen/tab_height"
android:background="@drawable/tab_selector"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:padding="@dimen/tab_padding"
android:weightSum="0.5" >
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="center_horizontal|center_vertical"
android:textColor="@drawable/tab_text_selector"
android:textSize="@dimen/text_default"
android:textStyle="italic" />
</RelativeLayout>
両方のタブのサイズが同じである必要がありますか? – Rookie
@ Raghavはい、どちらも有効な画面幅を占有する必要があります。また、各タブの左側にアイコンを設定したいと思います。注:アイコンの動作は異なります。私は問題のtab.xmlを追加しました。 – mask