How can I add shadow under the title text?
The following xml doesn't do the trick.
<style name="Theme" parent="android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/ActionBar</item>
<item name="android:windowBackground">@drawable/background</item>
</style>
<style name="ActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background"&开发者_C百科gt;@drawable/action_bar</item>
<item name="android:titleTextStyle">@style/TitleTextStyle</item>
</style>
<style name="TitleTextStyle" parent="android:style/TextAppearance.Large">
<item name="android:textColor">@color/title_text_color</item>
<item name="android:textStyle">bold</item>
<item name="android:shadowColor">@color/title_shadow_color</item>
<item name="android:shadowDx">0</item>
<item name="android:shadowDy">0</item>
<item name="android:shadowRadius">1</item>
</style>
Adding a shadow under the title of the (native) ActionBar works starting with API Level 18 (Android Jelly Bean 4.3). Works fine in API Level 19 (Android KitKat 4.4).
See my answer for XML code and a screenshot.
It's there, you just don't see it. You need to displace the shadow using either (or both) shadowDx
or shadowDy
(wow, quite an old question, how come no answers except the totally relevant comment by @James)
精彩评论