Android drawables和样式:找不到与styles.xml

时间:2017-01-11 16:05:59

标签: android xml android-resources attr

编译我的应用时,会出现以下错误:

Error: No resource found that matches the given name: attr 'android:frameDuration'.
Error: No resource found that matches the given name: attr 'android:selectionDividerHeight'.   
Error retrieving parent for item: No resource found that matches the given name 'android:style/Widget.QuickContactBadgeSmall.WindowLarge'.      
Error: No resource found that matches the given name: attr 'android:foregroundInsidePadding'.
Error: No resource found that matches the given name: attr 'android:listItemLayout'.
Error retrieving parent for item: No resource found that matches the given name 'android:style/Animation.OptionsPanel'.

我不熟悉这一点,对我来说并不明显。 我尝试添加@android:style/,甚至删除@,而不更改结果。

以下是styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Ab" parent="@android:style/Theme.Holo.Light">
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Ab</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.Ab</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Ab</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_ab</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Ab</item>
    <item name="android:actionOverflowButtonStyle">@style/OverflowStyle</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Ab</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Ab</item>
    <item name="android:selectionDividerHeight">@drawable/selectable_background_ab</item>
    <item name="android:frameDuration">@drawable/cab_background_bottom_ab</item>
</style>
<style name="OverflowStyle" parent="@android:style/Widget.ActionButton.Overflow">
    <item name="android:src">@drawable/ic_action_search</item>
</style>
<style name="ActionBar.Solid.Ab" parent="@android:style/Widget.QuickContactBadgeSmall.WindowLarge">
    <item name="android:progressBarStyle">@style/ProgressBar.Ab</item>
    <item name="android:background">@drawable/gradient_background</item>
    <item name="android:listItemLayout">@drawable/transparent</item>
    <item name="android:foregroundInsidePadding">@drawable/border_top_tabbar</item>
</style>
<style name="ActionBar.Transparent.Ab" parent="@android:style/Widget.Holo.Light.ActionBar">
    <item name="android:progressBarStyle">@style/ProgressBar.Ab</item>
    <item name="android:background">@drawable/ab_transparent_ab</item>
</style>
<style name="PopupMenu.Ab" parent="@android:style/Widget.Holo.Light.ListPopupWindow">
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_ab</item>
</style>
<style name="DropDownListView.Ab" parent="@android:style/Widget.Holo.Light.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_ab</item>
</style>
<style name="ActionBarTabStyle.Ab" parent="@android:style/Animation.OptionsPanel">
    <item name="android:background">@drawable/tab_indicator_ab_ab</item>
</style>
<style name="DropDownNav.Ab" parent="@android:style/Widget.Holo.Light.Spinner">
    <item name="android:background">@drawable/spinner_background_ab_ab</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_ab</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_ab</item>
</style>
<style name="ProgressBar.Ab" parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_ab</item>
</style>
<style name="ActionButton.CloseMode.Ab" parent="@android:style/Widget.Holo.Light.ActionButton.CloseMode">
    <item name="android:background">@drawable/btn_cab_done_ab</item>
</style>
<style name="Theme.Ab.Widget" parent="@android:style/Theme.Holo">
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Ab</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Ab</item>
</style>
</resources>

你能帮我解决这个问题。

1 个答案:

答案 0 :(得分:1)

ProgressBar

这些值都应该是整数,而不是drawable。除此之外,我不确定将这些值应用到主题上是否有意义。持续时间将应用于selectionDividerHeightAdapterView应用于ListView的某些变体,例如GridView / @android:style/Widget.QuickContactBadgeSmall.WindowLarge

  

检索项目的父项时出错:找不到与给定名称“android:style / Widget.QuickContactBadgeSmall.WindowLarge”匹配的资源。

不确定...那个主题肯定存在。请务必使用No resource found that matches the given name: attr 'android:foregroundInsidePadding'. No resource found that matches the given name: attr 'android:listItemLayout'.

https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml#L784

listItemLayout

我可以为insidePadding找到的唯一参考是它的值是真/假,而不是可绘制的 我不确定{{1}},但is a similar attribute only used by the IDE。适配器负责实际膨胀正确的布局。

  

检索项目的父项时出错:找不到与给定名称匹配的资源'android:style / Animation.OptionsPanel'

同样,这个也存在。

https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml#L137