Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionBar background image

I've inherited the Holo Light Theme and customized the background of the ActionBar with the following:

Content of styles.xml

<?xml version="1.0" encoding="utf-8"?> <resources> <style name="ActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:background">@drawable/actionbar_background</item> </style> <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> <item name="android:actionBarStyle">@style/ActionBar</item> </style> </resources> 

Content of actionbar_background.xml

<?xml version="1.0" encoding="utf-8"?> <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@raw/actionbar_background" android:tileMode="repeat" /> 

Instead of being repeated, the image is stretched, any idea of why android:tileMode="repeat" is not applied?

Thanks in advance

like image 291
rnoway Avatar asked May 02 '11 20:05

rnoway


People also ask

Where is ActionBar in Android?

Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.

What is an ActionBar?

An on-screen toolbar displaying icons that are clicked or tapped to perform various functions. For example, the menu bar at the top of an Android app is called an action bar.


1 Answers

Drawable d=getResources().getDrawable(R.drawable.background_image_name);   getActionBar().setBackgroundDrawable(d); 

The above code sets the background image for the action bar.
Hope it helps.

like image 194
Raj Trivedi Avatar answered Oct 05 '22 10:10

Raj Trivedi