简体   繁体   中英

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

Error retrieving parent for item: No resource found that matches the given name

in styles.xml file. Where is my mistake?

My 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:

<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:

   <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:

<style name="CustomThemeHossein">

in themes.xml and call this theme with:

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

Because it's a <style> and not a <theme> .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM