Reputation: 43
I am using ActionBar Sherlock and I wanted to change the ActionBar background. I was able to achieve this by modifying my style XML file:
<item name="android:background">@drawable/background_bitmap</item>
The problem is that no matter of device or position (landscape/horizontal) the actionbar background graphic is always stretched as shown here:
Portrait mode:
Landscape mode:
Is there a way to change the way the background_bitmap is shown?
I'd rather the background is either aligned to the left/right or zoomed and cropped.
Upvotes: 2
Views: 1187
Reputation: 15728
Yes, create a drawable xml like this in /res/drawable/
and reference it as the action bar background drawable.
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="right"
android:src="@drawable/background_bitmap" />
Upvotes: 6