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.
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" />
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.