如何通过将它们集成到主题中来更改我的按钮的样式?

时间:2014-03-17 10:42:32

标签: android xml android-layout

我使用动作栏appcompat生成一个主题,这里是它的代码:

<resources>

<style name="Theme.Demostyle" parent="@style/Theme.AppCompat.Light">
    <item name="actionBarItemBackground">@drawable/selectable_background_demostyle</item>
    <item name="popupMenuStyle">@style/PopupMenu.Demostyle</item>
    <item name="dropDownListViewStyle">@style/DropDownListView.Demostyle</item>
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Demostyle</item>
    <item name="actionDropDownStyle">@style/DropDownNav.Demostyle</item>
    <item name="actionBarStyle">@style/ActionBar.Solid.Demostyle</item>
    <item name="actionModeBackground">@drawable/cab_background_top_demostyle</item>
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_demostyle</item>
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Demostyle</item>


</style>

<style name="ActionBar.Solid.Demostyle" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
    <item name="background">@drawable/ab_solid_demostyle</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_demostyle</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_demostyle</item>
    <item name="progressBarStyle">@style/ProgressBar.Demostyle</item>
</style>

<style name="ActionBar.Transparent.Demostyle" parent="@style/Widget.AppCompat.Light.ActionBar">
    <item name="background">@drawable/ab_transparent_demostyle</item>
    <item name="progressBarStyle">@style/ProgressBar.Demostyle</item>
</style>

现在我想为我的按钮整合这个主题样式。这是我尝试的代码:

<style name="ActionBar.Buttons" parent="@style/Widget.AppCompat.Light.Buttons">
<item name="background">@drawable/blue button</item>
</item>
</style>

但是我得到错误而且它不起作用。它给出了未找到资源的错误。 “@ style / Widget.AppCompat.Light.Buttons”是它抱怨的资源。我的问题是如何设置我的按钮样式。这是我的屏幕截图: enter image description here

我希望buttnos也是蓝色的。

0 个答案:

没有答案