Reputation: 227
I set a background image to my actionbar wich has a wood texture and a drop shadow with transparency at the bottom, the problem is that the views inside of my actionbar are vertical aligned at middle so they look like they are "out" of the actionbar. I wonder if there is a way to place those views on top of the actionbar (I already tried to change the gravity and paddingTop but I still don't get it to work).
This is what I'd tried without success:
<style name="UniversiaTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="android:actionBarSize">68dp</item>
<item name="android:windowBackground">@drawable/background</item>
</style>
<style name="ActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:layout_gravity">top</item>
<item name="android:gravity">top</item>
<item name="android:background">@drawable/ab_background</item>
<item name="android:titleTextStyle">@style/ActionBar.TitleTextStyle</item>
</style>
<style name="ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/brown</item>
<item name="android:textSize">@dimen/titleSize_default</item>
</style>
And here is an screenshot image of how my actionbar looks like:
EDIT: Maybe this image will help to explain the issue a little bit better. Notice the background image which has a transparency and only covers the half of the actionbar space. (That's why I what to place the views that are inside of the actionbar on top, not on the middle of the actionbar)
Thank you in advance, I would appreciate any help.
Upvotes: 1
Views: 1826
Reputation: 9284
Try playing around with the setting for "android:layout_marginBottom" or "android:paddingBottom" instead of gravity in your ActionBar style. I was playing around with a sample project and it looks like that will work. Something between 10-20dp should do the trick.
Upvotes: 3