gpt4 book ai didi

android - 将 Holo Action Bar 保留在 Lollipop 中

转载 作者:太空狗 更新时间:2023-10-29 13:22:07 25 4
gpt4 key购买 nike

有什么方法可以强制应用程序在 Lollipop 设备中显示 Holo Action Bar?

我的主题当前继承自 Holo.Light,但我看到了新的操作栏。 Youtube 应用程序执行此操作,但我相信它使用的是旧版本的 AppCompat 库。

有什么建议吗?

最佳答案

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

直接或作为继承主题使用 Theme.Holo 或其子主题之一。

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

首先,here is a sample project在其 list 中直接使用 Theme.Holo.Light.DarkActionBar:

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

在运行 Android 5.0 的 Nexus 4 上运行时的结果显示了全息式操作栏,甚至显示了现已弃用的拆分操作栏模式:

ShareNative sample app, as initially run

Here is a sample app指的是自定义主题:

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

自定义主题继承自 Theme.Holo 并修改操作栏,由 Jeff Gilfelt 提供 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>

在运行 Android 5.0 的 Nexus 4 上运行时的结果显示样式化的操作栏:

HoloColor demo, as initially run

如果您可以提供可重现的测试用例来演示基于 Theme.Holo 的应用程序提供 Material-ish 外观(这是我对“新操作栏”的解释),请上传它某处。

关于android - 将 Holo Action Bar 保留在 Lollipop 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27389689/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com