2012-02-23 16 views
2

私のstyles.xmlファイルでTabWidgetのカスタムスタイルを定義して、アプリケーションのすべてのTabWidgetの背景を変更しました。スタイルTabWidget styles.xmlの背景

<item name="android:tabWidgetStyle">@style/CustomTabWidget</item> 
<style name="CustomTabWidget" parent="@android:style/Widget.TabWidget"> 
    <item name="android:background">@drawable/tab_bg</item> 
</style> 

アプリケーションのバックグラウンドは同じです。カスタムListViewスタイルの同様の定義が正しく機能します。レイアウトでTabWidgetの背景を設定すると、それは機能します。

<TabWidget 
android:id="@android:id/tabs" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/tab_bg" /> 

styles.xmlからTabWidgetの背景を設定する方法を教えてください。

答えて

2

マニフェストで定義したカスタムテーマにandroid:tabWidgetStyleアイテムを入れていますか?

のstyles.xml:

<style name="CustomTheme" parent="Theme.Holo.Light"> 
    <item name="android:tabWidgetStyle">@style/LightTabWidget</item> 
</style> 

のAndroidManifest.xml:

<application android:name="yourappname" 
      android:label="@string/app_name" 
      android:icon="@drawable/logo" 
      android:theme="@style/CustomTheme"> 
関連する問題