Gingerbread devices not using the Theme.AppCompat Holo style (support library)

I am using the v4 and v7 support library to integrate the action bar and navigation box in my application that supports API 10 +.

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

Everything works fine, except when I test on Gingerbread devices, things like a drop-down menu have a white background (skin from the phone), and text fields do not use holographic style backgrounds (again, the phone uses skin).

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

Thanks in advance.

+6
source share
1 answer

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

In the support library, you can use some extremely important user interface elements and APIs that are not available in versions of Android prior to Honeycomb (for example, ActionBar), but the style of widgets will remain the same as for the API level on which the phone actually runs.

You have several options:

1.) Extract resources from one of the API> = 14 platforms / subdirectories of your Android SDK installation and copy / edit the drawings and styles for the widgets that you want to change yourself. However, this is something that I do not recommend at all, because it will be a long and difficult task if you use many different widgets that require this setting.

2.) Use Android Holo Colors, which is an online generator for resources compatible with Holo, and immediately supports almost all widgets: http://android-holo-colors.com/ Just select your preferred color, the version of the API you want support, and widgets that you want to adapt to Holo. Holo Colors will create an archive containing all the definitions of the drawings and styles. You can copy into your project right away styles that you may have to integrate into existing styles. Xml

3.) There is a library called HoloEverywhere ( https://github.com/Prototik/HoloEverywhere ), in which there are already most widgets adapted for Holo, you need to expand your custom activity class and directly refer to their adapted widget classes.

Hope this helps!

+4
source

Source: https://habr.com/ru/post/958039/


All Articles