我正在使用 Android 原生操作栏。我想添加我自己的可绘制资源作为操作栏的背景。所以,我做了一个如下的主题:
res/values/themes.xml :
<style name="Theme.MyStyle" parent="android:style/Theme.Holo.Light">
<item name="android:background">@drawable/my_bg</item>
</style>
然后,在AndroidManifest.xml文件我将此样式添加到我的应用程序中:
<application
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.MyStyle"
>
<activity ...>
<activity .../>
...
</application>
BUT,应用背景绘制NOT ONLY到操作栏BUT ALSO到所有片段的内容。为什么?
我的第二个问题是,如何定制overflow图标和操作栏上最左边的“向上”按钮?
try
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="Theme.MyStyle" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<!-- other activity and action bar styles here -->
</style>
<!-- style for the action bar backgrounds -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/ab_background</item>
<item name="android:backgroundStacked">@drawable/ab_background</item>
<item name="android:backgroundSplit">@drawable/ab_split_background</item>
</style>
</resources>
定制标志 http://developer.android.com/reference/android/app/ActionBar.html#setDisplayUseLogoEnabled%28boolean%29 using setDisplayUseLogoEnabled(boolean)
更多信息 http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)