如何在styles.xml中引用HoloEverywhere?

时间:2012-12-09 03:58:30

标签: android actionbarsherlock android-theme android-holo-everywhere

如何从我的项目中引用HoloEverywhere主题?这是我的styles_course.xml文件,需要父主题,最好是带有暗动作条的全息灯。请注意,parent属性为空。

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

谢谢!

3 个答案:

答案 0 :(得分:1)

为应用程序或活动创建自己的主题,如下所示:

<style name="AppTheme" parent="Holo.Theme">
<!-- Or use <style name="AppTheme" parent="@style/Holo.Theme"></style> -->
</style>
  1. 当然,如果您参考项目中的holoeverywhere图书馆项目,这是有效的。
  2. 您的Activity应该延伸org.holoeverywhere.app.Activity
  3. 当然,您应该将此主题应用于Manifest中的活动或应用程序。
  4. 还有Holo.Theme.LightHolo.Theme.Light.DarkActionBar

    等主题

    here是所有样式的列表。

答案 1 :(得分:0)

<resources>
    <style name="MyTheme" parent="@android:styl e/Theme.Holo">
        <!-- Any customizations for your app ru nning on devices with Theme.Holo here -->
     </style>
</resources>

此外,这是了解更多信息的好资源:http://android-developers.blogspot.com/2012/01/holo-everywhere.html

答案 2 :(得分:0)

你试过这个吗?

"@style/Holo.Theme.Sherlock.Light.DarkActionBar"

编辑:

对于holoeverywhere 1.4其

@style/Holo.Theme.Light.DarkActionBar