2013-09-23 34 views
1

如何管理操作欄標籤width.here連接screen .如何減少動作條的標籤寬度編程

+0

這裏我也有另外一個標籤,我想調整其他標籤也不用滾動標籤 – user1987430

+0

這是因爲你的圖片不能填充整個標籤?你不應該只是嘗試準備更好的圖像? – Szymon

+0

@Szymon,我想OP是試圖說他們不希望滾動標籤標題。他們希望所有標題在一個屏幕中可見,即如果總共有5個標籤,則所有標題都應該可見。 – ozbek

回答

1

你可以嘗試刪除其默認填充,通過重寫默認樣式:

<style name="TabViewNoPadding" parent="@android:style/Widget.Holo.Light.ActionBar.TabView.Inverse"> 
    <item name="android:padding">0dp</item> 
</style> 

然後設置這種風格在你的應用主題:

<item name="android:actionBarTabStyle">@style/TabViewNoPadding</item> 
0

你可以使用動作欄選項卡樣式。

對於小於14的Android版本,將以下內容添加到您的應用程序主題中;

<style name="Theme.Apptheme" parent="@style/Theme.AppCompat.Light"> 
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Apptheme</item> 
</style> 

<style name="ActionBarTabStyle.Apptheme" parent="@style/Widget.AppCompat.ActionBar.TabView"> 
    <item name="android:paddingLeft">0dp</item> 
    <item name="android:paddingRight">0dp</item> 
</style> 

對於版本14及以上版本,請參閱相同。

<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Apptheme</item>