ActionBarSherlock - 设置操作栏问题的样式

时间:2013-08-14 03:12:36

标签: android actionbarsherlock

我正在使用actionBar sherlock并且在设置操作栏样式时遇到问题。加载开始活动动作栏后,只有一台设备(三星galaxy nexus)失去它的风格(变成白色,而不是我的背景图像)。这里有一些代码:

actionbar_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);}

拜托,帮助我,某人!!!

0 个答案:

没有答案
相关问题