我正嘗試在應用程序中更改操作欄的顏色。我找到了this answer這表明了一種方法。所以,我創建了一個themes.xml
文件res/values
文件夾下有以下幾點:如何使用actionbarsherlock更改操作欄的顏色
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverFlow">
<item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
<item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>
<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
<item name="android:background">#fff4231e</item>
<item name="background">#fff4231e</item>
</style>
</resources>
不過,我得到在上面的代碼中的錯誤:
的項目在我的build.gradle錯誤檢索父:沒有資源發現匹配 名稱爲'Theme.Sherlock.ForceOverFlow'。
我有以下幾點:
compile 'com.actionbarsherlock:actionbarsherlock:[email protected]'
我使用AndroidStudio和搖籃
如果你正在使用Eclipse,我有時編輯我的風格的時候會有奇怪解析錯誤。 xml文件。您是否嘗試打開「問題」窗口,刪除錯誤消息並嘗試重建項目? - 另外,如果您使用的是4.2.0或更高版本,那麼顯然它已被刪除:http://stackoverflow.com/a/13180285/1426565 – Guardanis