做这样的:
<style name="CustomStyle" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/CustomActionBar</item>
</style>
<style name="CustomActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/ANY_DRAWABLE</item>
<item name="android:displayOptions">useLogo|showHome</item>
...
<item name="PARAM">VALUE</item>
</style>
在CustomActionBar风格,你可以设置动作条PARAMS。在您的活动中使用CustomStyle。
UPDATE:您可以在Manifest中使用CustomStyle作为所有应用程序。只要做到这一点:
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/CustomStyle">
或使用每个活动时间:
<activity
android:name="MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/CustomStyle">
祝你好运!
你正在使用哪个android平台,并使用Android Default ActionBar或ActionBarSherlock? – hardartcore
我正在使用Android默认ActionBar。 – Kevin
您是否在清单文件中添加样式,如下面的回答者所说的? – Kanth