简体   繁体   中英

android - two color Action Bar background

I'm using ActionbarSherlock . I need to create a background style for the Action Bar as image below.

动作栏图片

I can create a plain color background style with a 9-patch image, but this seems quite complex to me. please give me a clue to achieve this.

Create 9-patch graphics for all action bar heights, that is 48 dp (portrait), 40 dp (landscape) and 56 dp (tablet). Provide the graphics at least in xhdpi.

Here is the graphic for phone, portrait (xhdpi). Rename to ab_bg.9.png

9补丁

<style name="AppTheme" parent="Theme.Sherlock">
    <item name="actionBarStyle">@style/Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Styled.ActionBar</item>
</style>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM