简体   繁体   English

Android:自定义主题:样式:检索项目父项:找不到与给定名称匹配的资源

[英]Android:Custom Theme:styles:Error retrieving parent for item: No resource found that matches the given name

I made a custom Theme , but I got an error 我制作了一个自定义Theme ,但出现错误

Error retrieving parent for item: No resource found that matches the given name 检索父项时出错:找不到与给定名称匹配的资源

in styles.xml file. styles.xml文件中。 Where is my mistake? 我的错误在哪里?

My themes.xml: 我的themes.xml:

    <!-- Custom Theme Design By Hossein -->
<style name="Theme.CustomThemeHossein">
    <item name="android:windowNoTitle">true</item>
     <item name="colorBackground">@android:color/background_light</item>
       <item name="windowBackground">@android:drawable/bghos</item>
    <item name="colorBackground">@android:color/background_light</item>
    <item name="colorForeground">@color/bright_foreground_light</item>
    <item name="colorForegroundInverse">@android:color/bright_foreground_light_inverse</item>

    <item name="textColorPrimary">@android:color/primary_text_light</item>
    <item name="textColorSecondary">@android:color/secondary_text_light</item>
    <item name="textColorTertiary">@android:color/tertiary_text_light</item>
    <item name="textColorPrimaryInverse">@android:color/primary_text_dark</item>
    <item name="textColorSecondaryInverse">@android:color/secondary_text_dark</item>
    <item name="textColorTertiaryInverse">@android:color/tertiary_text_dark</item>
    <item name="textColorPrimaryDisableOnly">@android:color/primary_text_light_disable_only</item>
    <item name="textColorPrimaryInverseDisableOnly">@android:color/primary_text_dark_disable_only</item>
    <item name="textColorPrimaryNoDisable">@android:color/primary_text_light_nodisable</item>
    <item name="textColorSecondaryNoDisable">@android:color/secondary_text_light_nodisable</item>
    <item name="textColorPrimaryInverseNoDisable">@android:color/primary_text_dark_nodisable</item>
    <item name="textColorSecondaryInverseNoDisable">@android:color/secondary_text_dark_nodisable</item>
    <item name="textColorHint">@android:color/hint_foreground_light</item>
    <item name="textColorHintInverse">@android:color/hint_foreground_dark</item>        
    <item name="textColorHighlight">@android:color/highlighted_text_light</item>
    <item name="textColorHighlightInverse">@android:color/highlighted_text_dark</item>
    <item name="textColorLink">@android:color/link_text_light</item>
    <item name="textColorLinkInverse">@android:color/link_text_dark</item>

    <item name="editTextColor">@android:color/primary_text_light</item>
    <item name="listChoiceBackgroundIndicator">@android:drawable/list_selector_background</item>

    <item name="activatedBackgroundIndicator">@android:drawable/activated_background_light</item>
    <item name="quickContactBadgeOverlay">@android:drawable/quickcontact_badge_overlay_light</item>

    <item name="popupWindowStyle">@android:style/Widget.PopupWindow</item>

    <item name="textCheckMark">@android:drawable/indicator_check_mark_light</item>
    <item name="textCheckMarkInverse">@android:drawable/indicator_check_mark_dark</item>

    <item name="gestureOverlayViewStyle">@android:style/Widget.GestureOverlayView.White</item>
    <item name="expandableListViewStyle">@android:style/Widget.ExpandableListView.White</item>
    <item name="listViewStyle">@android:style/Widget.ListView.White</item>
    <item name="listDivider">@drawable/divider_horizontal_bright</item>
    <item name="listSeparatorTextViewStyle">@android:style/Widget.TextView.ListSeparator.White</item>

    <item name="progressBarStyle">@android:style/Widget.ProgressBar.Inverse</item>
    <item name="progressBarStyleSmall">@android:style/Widget.ProgressBar.Small.Inverse</item>
    <item name="progressBarStyleLarge">@android:style/Widget.ProgressBar.Large.Inverse</item>
    <item name="progressBarStyleInverse">@android:style/Widget.ProgressBar</item>
    <item name="progressBarStyleSmallInverse">@android:style/Widget.ProgressBar.Small</item>
    <item name="progressBarStyleLargeInverse">@android:style/Widget.ProgressBar.Large</item>
    <item name="actionModeCutDrawable">@android:drawable/ic_menu_cut_holo_light</item>
    <item name="actionModeCopyDrawable">@android:drawable/ic_menu_copy_holo_light</item>
    <item name="actionModePasteDrawable">@android:drawable/ic_menu_paste_holo_light</item>
    <item name="actionModeSelectAllDrawable">@android:drawable/ic_menu_selectall_holo_light</item>
    <item name="actionModeShareDrawable">@android:drawable/ic_menu_share_holo_light</item>
    <item name="actionModeFindDrawable">@android:drawable/ic_menu_find_holo_light</item>
    <item name="actionModeWebSearchDrawable">@android:drawable/ic_menu_search_holo_light</item>
    <item name="actionModeBackground">@android:drawable/cab_background_top_holo_light</item>
    <item name="actionModeSplitBackground">@android:drawable/cab_background_bottom_holo_light</item>

    <!-- SearchView attributes -->
    <item name="searchDropdownBackground">@android:drawable/search_dropdown_light</item>
    <item name="searchViewTextField">@drawable/textfield_searchview_holo_light</item>
    <item name="searchViewTextFieldRight">@drawable/textfield_searchview_right_holo_light</item>
    <item name="searchViewCloseIcon">@android:drawable/ic_clear_holo_light</item>
    <item name="searchViewSearchIcon">@android:drawable/ic_search_api_holo_light</item>
    <item name="searchViewGoIcon">@android:drawable/ic_go_search_api_holo_light</item>
    <item name="searchViewVoiceIcon">@android:drawable/ic_voice_search_api_holo_light</item>
    <item name="searchViewEditQuery">@android:drawable/ic_commit_search_api_holo_light</item>

    <item name="detailsElementBackground">@android:drawable/panel_bg_holo_light</item>

    <item name="mediaRouteButtonStyle">@android:style/Widget.DeviceDefault.Light.MediaRouteButton</item>
    <item name="findOnPageNextDrawable">@android:drawable/ic_find_next_holo_light</item>
    <item name="findOnPagePreviousDrawable">@android:drawable/ic_find_previous_holo_light</item>
</style>

My styles.xml: 我的styles.xml:

<resources>

<!--
    Base application theme, dependent on API level. This theme is replaced
    by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
    <!--
        Theme customizations available in newer API levels can go in
        res/values-vXX/styles.xml, while customizations related to
        backward-compatibility can go here.
    -->
</style>

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

    <style name="CustomThemeHossein" parent="android:Theme.CustomThemeHossein">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

My AndroidManifest.xml: 我的AndroidManifest.xml:

   <application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/CustomThemeHossein" >

The error: 错误:

[2015-12-18 14:19:54 - WifiTrafficMonitor] E:\E\All-Project\Android\WifiTrafficMonitor\res\values\styles.xml:20: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.CustomThemeHossein'.

How to solve it? 怎么解决呢?

You have to change Theme.CustomThemeHossein by: 您必须通过以下方式更改Theme.CustomThemeHossein

<style name="CustomThemeHossein">

in themes.xml and call this theme with: themes.xml并使用以下命令调用此主题:

<style name="ThemeHossein" parent="@style/CustomThemeHossein">

Because it's a <style> and not a <theme> . 因为它是<style>而不是<theme>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 键入错误:检索项目的父项时出错:未找到与给定名称&#39;Theme.AppCompat.Light&#39;匹配的资源。 styles.xml Android AAPT - Type error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. styles.xml Android AAPT 错误:检索父项时出错:找不到与给定名称&#39;android:Theme.Holo.Light.DarkActionBar&#39;匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar' 错误:检索项目父项时出错:找不到与给定名称&#39;android:Theme.DeviceDefault.Light&#39;相匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.DeviceDefault.Light' 键入错误:检索项目的父项时出错:未找到与给定名称&#39;android:Theme.Holo.Light&#39;相匹配的资源。 - Type error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'. 错误:检索项目的父项时出错:找不到与给定名称“android:Theme.Holo”匹配的资源 - error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo' 检索项目的父项时出错:找不到与给定名称“android:Theme.Material.Light”匹配的资源 - Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light' 检索父项时出错:找不到与给定名称“ Android:Theme.Material”匹配的资源 - Error retrieving parent for item: No resource found that matches the given name 'Android:Theme.Material' 检索项目的父项时出错:找不到与给定名称匹配的资源&#39;@android:style / Theme.AppCompat.Light.DarkActionBar&#39; - Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar' Android studio错误检索项目的父项:找不到与给定名称“Theme.AppCompat.Light.DarkActionBar”匹配的资源 - Android studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar' 检索项目的父项的 Android 错误:找不到与给定名称匹配的资源 - Android Error retrieving parent for item: No resource found that matches the given name
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM