做這樣的:
<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