我试图改变应用程序的风格,但一切都是灰色的.有什么问题?
我正在使用android studio.这个项目最初是在eclipse上进行的.我不是在Android Studio上使用Lollipop构建它
<application
android:name=".MainApplication"
tools:replace="android:icon,android:theme"
android:label="@string/app_name"
android:logo="@drawable/ic_logo"
android:theme="@style/Theme.Materialred" >
styles_materialred.xml:
<resources>
<style name="Theme.Materialred" parent="@style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">@drawable/selectable_background_materialred</item>
<item name="popupMenuStyle">@style/PopupMenu.Materialred</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Materialred</item>
<item name="actionBarTabStyle">@style/ActionBarTabStyle.Materialred</item>
<item name="actionDropDownStyle">@style/DropDownNav.Materialred</item>
<item name="actionBarStyle">@style/ActionBar.Solid.Materialred</item>
<item name="actionModeBackground">@drawable/cab_background_top_materialred</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_materialred</item>
<item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Materialred</item>
</style>
<style name="ActionBar.Solid.Materialred" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">@drawable/ab_solid_materialred</item>
<item name="backgroundStacked">@drawable/ab_stacked_solid_materialred</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_materialred</item>
<item name="progressBarStyle">@style/ProgressBar.Materialred</item>
</style>
<style name="ActionBar.Transparent.Materialred" parent="@style/Widget.AppCompat.Light.ActionBar">
<item name="background">@drawable/ab_transparent_materialred</item>
<item name="progressBarStyle">@style/ProgressBar.Materialred</item>
</style>
<style name="PopupMenu.Materialred" parent="@style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_materialred</item>
</style>
<style name="DropDownListView.Materialred" parent="@style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_materialred</item>
</style>
<style name="ActionBarTabStyle.Materialred" parent="@style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_ab_materialred</item>
</style>
<style name="DropDownNav.Materialred" parent="@style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">@drawable/spinner_background_ab_materialred</item>
<item name="android:popupBackground">@drawable/menu_dropdown_panel_materialred</item>
<item name="android:dropDownSelector">@drawable/selectable_background_materialred</item>
</style>
<style name="ProgressBar.Materialred" parent="@style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_horizontal_materialred</item>
</style>
<style name="ActionButton.CloseMode.Materialred" parent="@style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">@drawable/btn_cab_done_materialred</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Materialred.Widget" parent="@style/Theme.AppCompat">
<item name="popupMenuStyle">@style/PopupMenu.Materialred</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Materialred</item>
</style>
最佳答案 在动作栏主题中以这种方式设置颜色.
<item name="colorPrimary">@color/primaryDef</item>
阅读Chris Banes https://chris.banes.me/2014/10/17/appcompat-v21/#migrationfromprevioussetup这篇有趣的文章