【问题标题】:ActionBarSherlock Background StyleActionBarSherlock 背景样式
【发布时间】:2013-05-04 21:44:46
【问题描述】:

为了让操作栏变成蓝色,我一直在使用以下代码:

com.actionbarsherlock.view.MenuInflater inflater = getSupportMenuInflater();
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00BFFF")));

但是当用户切换到应用程序控制之外的其他屏幕时,代码似乎不太方便。我尝试使用样式属性

<item name = "android:background">#00BFFF</item>

但这会扰乱应用程序的整个显示。有什么我想念的吗?有人可以建议我吗?如何实现 actionbarsherlock 背景?

【问题讨论】:

    标签: android styles actionbarsherlock


    【解决方案1】:

    在你的styles.xml中这样应用

    <!-- "Implementation" of our ABS custom theme -->
        <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
            <item name="titleTextStyle">@style/TitleText</item>
            <item name="android:background">@drawable/ab_background</item>
            <item name="background">@drawable/ab_background</item>
            <item name="android:titleTextStyle">@style/TitleText</item>
        </style>
    

    &lt;item name="background"&gt;中为操作栏背景创建一个可绘制的 9 补丁。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多