不使用全息风格从Theme.AppCompat姜饼设备(支持库)姜饼、全息、风格、设备

2023-09-07 17:09:34 作者:迩的幸福卟在属于莪。

我使用的是V4和V7支持库的动作栏和导航抽屉我的应用程序,它支持API 10 +。

I'm using the v4 and v7 support library to integrate the action bar and navigation drawer in my app, which supports API 10+.

我跟着在开发者网站的指南使用Theme.AppCompat和风格/Widget.AppCompat.ActionBar作为我的主题和行动酒吧风格父,分别为。

I've followed the guide on the developer site to use Theme.AppCompat and style/Widget.AppCompat.ActionBar as the parent of my theme and action bar style, respectively.

一切工作正常,除非我的姜饼设备测试,诸如此类下拉/弹出菜单中有一个白色背景(从手机的皮肤)和文本字段不再次使用全息式的背景(,使用手机皮肤)。

Everything works fine, except when I test on Gingerbread devices, things like a dropdown/popup menu has a white background (skin from the phone) and text fields don't use the holo-style backgrounds (again, uses the phone skin).

有什么额外的,我需要这么做pre-全息设备继承了全息式的小部件?

Is there anything extra I need to do so pre-Holo devices inherit the holo-style widgets?

先谢谢了。

推荐答案

无论使用支持库,窗口小部件,如TextView的,微调,复选框,按钮,开关等,不会看的Holo风格自动。

Regardless of using the support library, widgets such as TextView, Spinner, CheckBox, Button, Switch etc. will not look Holo styled automatically.

哪些支持库让你做的是使用不可用在Honeycomb(如动作条)之前的Andr​​oid版本中一些极为重要的UI元素和API,但小部件的样式将保留为明显,因为它是相同的API级别手机实际运行。

What the support library lets you do is use some profoundly important UI elements and APIs that are not available on versions of Android before Honeycomb (like the ActionBar), but the style of the widgets will remain distinctly the same as it is for the API level the phone is actually running.

您有几种选择在这里:

1)从API的一个扫气资源> = 14平台/你的Andr​​oid SDK安装和复制的子目录/调整可绘制和样式要改变自己的小部件。然而,这是我完全不推荐,因为这将是一个长期而艰巨的任务,如果你正在使用需要这种调整很多不同的部件。

1.) Scavenge resources from one of the API >= 14 platforms/ subdirectories of your android SDK installation and copy/adjust the drawables and styles for the widgets you want to change yourself. However this is something I don't recommend at all, because it will be a long and arduous task if you are using many different widgets that need this kind of adjustment.

2)使用的Andr​​oid全息颜色,这是全息兼容资源在线发电机并支持几乎所有的部件的马上: http://android-holo-colors.com/ 只需选择您的preferred颜色,要支持和API的版本要适应全息小部件。霍洛颜色会生成一个包含所有可绘制和样式定义为你的存档。你可以pretty多拷贝到你的项目马上可绘制的,样式你可能必须集成到现有的styles.xml

2.) Use Android Holo Colors, which is an online generator for Holo compliant resources and supports almost all of the widgets right away: http://android-holo-colors.com/ Just pick your preferred color, the API version you want to support and the widgets you want to adapt to Holo. Holo Colors will generate an archive containing all the drawables and style definitions for you. The drawables you can pretty much copy into your project straight away, the styles you'll probably have to integrate into your existing styles.xml

3)有图书馆,名为HoloEverywhere( https://github.com/Prototik/HoloEverywhere),已经有适应霍洛大多数窗口小部件,但你需要扩展自己的自定义活动类,并直接引用他们的适应部件类。

3.) There is a library, called HoloEverywhere (https://github.com/Prototik/HoloEverywhere), which already has most widgets adapted to Holo, but you'll need to extend their custom activity class and directly reference their adapted widgets classes.

希望这有助于!