カスタム テーマを使用して、アクション バーにカスタム背景を表示しています。M は Actionbar Compat を使用しています。私はさまざまなデバイスで実行しましたが、モバイル + バージョン < 3.0 で奇妙な結果が得られました。したがって、いくつかのテストの後、背景として透明な色を設定した後でも、まだ何かが得られることがわかりました。私のnexus 4でも同じコードが正常に動作します。添付の画像を参照してください。
私のマニフェスト:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name">
<activity
android:name="com.abtest.MainActivity"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
私のスタイル:
<style name="Widget.Custom.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/actionbar_text_color</item>
</style>
<style name="Widget.Custom.Common" parent="@style/Widget.AppCompat.ActionBar">
<item name="titleTextStyle">@style/Widget.Custom.TitleTextStyle</item>
</style>
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.Custom.Common">
<item name="background">@color/actionbar_background</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBarOverlay">false</item>
</style>
私のアクションバーの背景:
<color name="actionbar_background">#00000000</color>