保持霍洛操作栏的棒棒糖 [英] Keeping the Holo Action Bar in Lollipop

查看:168
本文介绍了保持霍洛操作栏的棒棒糖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么办法来强制应用程序,以显示河洛操作栏的棒棒糖设备?

我的主题是当前从Holo.Light继承,但我看到了新的操作栏。 YouTube应用程序做到这一点,但我相信,它使用的是AppCompat库的旧版本。

有什么建议?

解决方案
  

有没有什么办法来强制应用程序,以显示河洛操作栏的棒棒糖设备?

使用 Theme.Holo 或其附属主题之一,​​直接或继承的主题。

  

我的主题是当前从Holo.Light继承,但我看到了新的操作栏

首先,下面是一个使用<示例项目 code> Theme.Holo.Light.DarkActionBar 直接在其清单:

 &lt;应用
    机器人:allowBackup =假
    机器人:图标=@可绘制/ ic_launcher
    机器人:标签=@字符串/ APP_NAME
    机器人:主题=@安卓风格/ Theme.Holo.Light.DarkActionBar
    机器人:uiOptions =splitActionBarWhenNarrow&GT;
 

结果上的Nexus 4运行Android 5.0显示全息式操作栏,甚至显示了目前德precated拆分操作栏模式中运行时:

下面是一个示例应用引用自定义主题:

 &lt;应用
    机器人:allowBackup =假
    机器人:图标=@可绘制/ ic_launcher
    机器人:标签=@字符串/ APP_NAME
    机器人:主题=@风格/ Theme.Apptheme&GT;
 

在这里的自定义主题,由 Theme.Holo 继承并修改操作栏,礼貌杰夫Gilfelt的的动作栏样式生成器

 &LT;样式名称=Theme.Apptheme父=@安卓风格/ Theme.Holo&GT;
    &LT;项目名称=机器人:actionBarItemBackground&GT; @可绘制/ selectable_background_apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:popupMenuStyle&GT; @风格/ PopupMenu.Apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:dropDownListViewStyle&GT; @风格/ DropDownListView.Apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionBarTabStyle&GT; @风格/ ActionBarTabStyle.Apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionDropDownStyle&GT; @风格/ DropDownNav.Apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionBarStyle&GT; @风格/ ActionBar.Solid.Apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionModeBackground&GT; @可绘制/ cab_background_top_apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionModeSplitBackground&GT; @可绘制/ cab_background_bottom_apptheme&LT; /项目&GT;
    &LT;项目名称=机器人:actionModeCloseButtonStyle&GT; @风格/ ActionButton.CloseMode.Apptheme&LT; /项目&GT;
&LT; /风格&GT;
 

结果上的Nexus 4上运行时,运行的Andr​​oid 5.0显示风格的动作栏:

如果您可以提供一个可重复的测试案例,演示了一个 Theme.Holo 为基础的应用程序提供了材料上下的样子(这是我的跨pretation新的操作栏),请上传它的地方。

Is there any way to force an app to display the Holo Action Bar in Lollipop devices?

My theme is currently inheriting from Holo.Light, yet I am seeing the new Action Bar. The Youtube app does this but I believe that it is using an older version of the AppCompat library.

Any suggestions ?

解决方案

Is there any way to force an app to display the Holo Action Bar in Lollipop devices?

Use Theme.Holo or one of its subsidiary themes, directly or as an inherited theme.

My theme is currently inheriting from Holo.Light, yet I am seeing the new Action Bar

First, here is a sample project that uses Theme.Holo.Light.DarkActionBar directly in its manifest:

<application
    android:allowBackup="false"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light.DarkActionBar"
    android:uiOptions="splitActionBarWhenNarrow">

The results when run on a Nexus 4 running Android 5.0 show the Holo-style action bar, even showing the now-deprecated split action bar pattern:

Here is a sample app that refers to a custom theme:

<application
    android:allowBackup="false"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/Theme.Apptheme">

where that custom theme inherits from Theme.Holo and modifies the action bar, courtesy of Jeff Gilfelt's Action Bar Style Generator:

<style name="Theme.Apptheme" parent="@android:style/Theme.Holo">
    <item name="android:actionBarItemBackground">@drawable/selectable_background_apptheme</item>
    <item name="android:popupMenuStyle">@style/PopupMenu.Apptheme</item>
    <item name="android:dropDownListViewStyle">@style/DropDownListView.Apptheme</item>
    <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Apptheme</item>
    <item name="android:actionDropDownStyle">@style/DropDownNav.Apptheme</item>
    <item name="android:actionBarStyle">@style/ActionBar.Solid.Apptheme</item>
    <item name="android:actionModeBackground">@drawable/cab_background_top_apptheme</item>
    <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_apptheme</item>
    <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Apptheme</item>
</style>

The results when run on a Nexus 4 running Android 5.0 show the styled action bar:

If you can offer a reproducible test case that demonstrates a Theme.Holo-based app offering a Material-ish look (which is my interpretation of "the new Action Bar"), please upload it somewhere.

这篇关于保持霍洛操作栏的棒棒糖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆