2012-02-02 13 views
0

アクションバーに3つのタブがあります。 次のようになります。 |すべて|コール|ネットワーク| 私は彼らに同じ幅を持たせたい。どうしたらいいですか?ActionBarタブの太さ/幅

答えて

2

としてタブホストを設定します。タブ。これが私のやり方です。私の場合、ActionBar.Tagで使われている組み込みのレイアウトに似ていたレイアウトからカスタムビューがロードされます。必要なものにマージン、サイズ、コンテンツを設定します。

+0

私はそれを試してみましょうについて話しています。ありがとう。 –

+0

Urielさん、うまくいきましたか? – habitats

0

彼らはすべて

<?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:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<HorizontalScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:fillViewport="true" 
    android:scrollbars="none"> 
<TabWidget 
    android:id="@android:id/tabs" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"/> 
</HorizontalScrollView> 
<FrameLayout 
    android:id="@android:id/tabcontent" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" /> 
</LinearLayout> 
</TabHost> 

同じ幅の列に整列してから、アクションバーにsetCustomView()メソッドを使用して任意のビューにタグを設定することができ

TabHost tabHost; 
TabHost.TabSpec spec; 
tabHost=getTabHost() 
Intent intent; 
intent=new Intent().setClass(this, BirthDayTab.class); 
spec=tabHost.newTabSpec("artists").setIndicator("BirthDay",res.getDrawable(R.drawable.ic_tab_artists)).setContent(intent); 
tabHost.addTab(spec); 
+2

番号を探している正確なソリューションです。 ** ActionBarタブ** –

関連する問題