1

我正在使用 actionBar sherlock 并且在设置操作栏的样式时遇到问题。加载启动活动操作栏后,仅在一台设备(三星银河系)上失去其样式(变为白色,而不是我的背景图像)。这里有一些代码:

动作栏样式:

@style/MyActionBarTabStyle

<style name="MyActionBarTabStyle" parent="Widget.Sherlock.Light.ActionBar">
    <item name="android:background">@drawable/head</item>
    <item name="android:backgroundSplit">@drawable/head</item>
    <item name="android:textColorHint">@color/blue_for_menu</item>
</style>

<style name="textStyleActionBar" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
</style>

和清单:

<application android:icon="@drawable/icon"
             android:label="@string/app_name"
             android:name="BBB"
             android:theme="@style/actionBarStyle"
        >

initActionBar 方法:

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        BitmapDrawable bg = (BitmapDrawable)getResources().getDrawable(R.drawable.head);
        bg.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        getSupportActionBar().setBackgroundDrawable(bg);

        BitmapDrawable bgSplit = (BitmapDrawable)getResources().getDrawable(R.drawable.head);
        bgSplit.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
        getSupportActionBar().setSplitBackgroundDrawable(bgSplit);

        // sm.setBackgroundResource(R.drawable.sliding_menu_selector_for_icecreamsandwich);
        // sm.setSelectorDrawable(R.drawable.sliding_menu_selector_for_icecreamsandwich);
        sm.setBackgroundResource(R.drawable.sliding_menu_selector_for_icecreamsandwich);
    }

}

private void actionBarInit() {
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    setSlidingActionBarEnabled(false);}

请帮帮我,有人!!!

4

0 回答 0