动作条自定义背景与分配器

动作条自定义背景与分配器

本文介绍了ActionBarSherlock - 动作条自定义背景与分配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我实施 ActionBarsherlock ,我想改变的动作条的背景。

I'm implementing ActionBarsherlock and I want to change the actionbar background.

我重写属性,但蓝色的分dissapear。如何使用自定义背景与蓝色的分?

I override the properties but the blue divider dissapear. How can I use custom background with the blue divider?

<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">#ff3e3f3d</item>
    <item name="background">#ff3e3f3d</item>
</style>

推荐答案

对于任何人谁(像我)不享受与9补丁图像打转转,您可以使用在操作栏的底部得到分频器XML绘制:

For anyone who (like me) doesn't enjoy playing around with 9-patch images, you can get the divider at the bottom of the action bar using an xml drawable:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Bottom Line -->
    <item>
        <shape android:shape="rectangle">
            <solid android:color="@color/action_bar_line_color" />
        </shape>
    </item>

    <!-- Color of your action bar -->
    <item android:bottom="2dip">
        <shape android:shape="rectangle">
            <solid android:color="@color/action_bar_color" />
        </shape>
    </item>
</layer-list>

另存为绘制/ action_bar_background.xml,然后把它应用在你的主题:

Save this as drawable/action_bar_background.xml, Then apply it in your theme:

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">@drawable/action_bar_background</item>
    <item name="background">@drawable/action_bar_background</item>
</style>

这篇关于ActionBarSherlock - 动作条自定义背景与分配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:04