Search code examples
androidactionbarsherlockandroid-themeandroid-holo-everywhere

How do I reference HoloEverywhere in styles.xml?


How do I reference the HoloEverywhere themes from my project? Here's my styles_course.xml file that needs a parent theme, preferably holo light with dark action bar. Notice that the parent attribute is blank.

   <?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator

     Copyright (C) 2012 readyState Software Ltd

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<resources>
<style name="Theme.course" parent="">
    <item name="android:windowBackground">@color/background</item>
    <item name="android:colorBackground">@color/background</item>
    <item name="actionBarItemBackground">@drawable/selectable_background_course</item>
    <item name="popupMenuStyle">@style/course_PopupMenu</item>
    <item name="dropDownListViewStyle">@style/course_DropDownListView</item>
    <item name="actionBarTabStyle">@style/course_ActionBarTabStyle</item>
    <item name="actionDropDownStyle">@style/course_DropDownNav</item>
    <item name="actionBarStyle">@style/course_solid_ActionBar</item>

    <item name="android:actionBarItemBackground">@drawable/selectable_background_course</item>
    <item name="android:popupMenuStyle">@style/course_PopupMenu</item>
    <item name="android:dropDownListViewStyle">@style/course_DropDownListView</item>
    <item name="android:actionBarTabStyle">@style/course_ActionBarTabStyle</item>
    <item name="android:actionDropDownStyle">@style/course_DropDownNav</item>
    <item name="android:actionBarStyle">@style/course_solid_ActionBar</item>
    <item name="android:panelBackground">@drawable/menu_hardkey_panel_course</item>

            <!-- Light.DarkActionBar specific -->
    <item name="actionBarWidgetTheme">@style/Theme.course.widget</item>
    <item name="android:actionBarWidgetTheme">@style/Theme.course.widget</item>

</style>

<style name="course_solid_ActionBar" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="background">@drawable/ab_solid_course</item>
    <item name="backgroundStacked">@drawable/ab_stacked_solid_course</item>
    <item name="backgroundSplit">@drawable/ab_bottom_solid_course</item>
    <item name="progressBarStyle">@style/course_ProgressBar</item>

    <item name="android:background">@drawable/ab_solid_course</item>
    <item name="android:backgroundStacked">@drawable/ab_stacked_solid_course</item>
    <item name="android:backgroundSplit">@drawable/ab_bottom_solid_course</item>
    <item name="android:progressBarStyle">@style/course_ProgressBar</item>
</style>

<style name="course_transparent_ActionBar" parent="@style/Widget.Sherlock.ActionBar">
    <item name="background">@drawable/ab_transparent_course</item>
    <item name="progressBarStyle">@style/course_ProgressBar</item>

    <item name="android:background">@drawable/ab_transparent_course</item>
    <item name="android:progressBarStyle">@style/course_ProgressBar</item>
</style>

<style name="course_PopupMenu" parent="@style/Widget.Sherlock.ListPopupWindow"> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_course</item>    
</style>

<style name="course_DropDownListView" parent="@style/Widget.Sherlock.ListView.DropDown">
    <item name="android:listSelector">@drawable/selectable_background_course</item>
</style>

<style name="course_ActionBarTabStyle" parent="@style/Widget.Sherlock.ActionBar.TabView">
    <item name="background">@drawable/tab_indicator_ab_course</item>

    <item name="android:background">@drawable/tab_indicator_ab_course</item>
</style>

<style name="course_DropDownNav" parent="@style/Widget.Sherlock.Spinner.DropDown.ActionBar">
    <item name="background">@drawable/spinner_background_ab_course</item>

    <item name="android:background">@drawable/spinner_background_ab_course</item>
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_course</item>
    <item name="android:dropDownSelector">@drawable/selectable_background_course</item>
</style>

<style name="course_ProgressBar" parent="@style/Widget.Sherlock.ProgressBar.Horizontal">
    <item name="android:progressDrawable">@drawable/progress_horizontal_course</item>
</style>

<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.course.widget" parent="@style/Theme.Sherlock">
    <item name="popupMenuStyle">@style/course_PopupMenu</item>
    <item name="dropDownListViewStyle">@style/course_DropDownListView</item>

    <item name="android:popupMenuStyle">@style/course_PopupMenu</item>
    <item name="android:dropDownListViewStyle">@style/course_DropDownListView</item>
</style>

Thanks!


Solution

  • Create your own theme for application or activity just like this:

    <style name="AppTheme" parent="Holo.Theme">
    <!-- Or use <style name="AppTheme" parent="@style/Holo.Theme"></style> -->
    </style>
    
    1. This works, of course if you refer to holoeverywhere library project from your project.
    2. Your Activity should extends org.holoeverywhere.app.Activity
    3. And of course, you should apply this theme either to activity or application in Manifest.

    There are also such themes like Holo.Theme.Light and Holo.Theme.Light.DarkActionBar

    And here is the list of all styles.