What is the AppCompat theme in Android?

I'm just starting out with Android development, so bear with me. I downloaded Android Studio, and when I started a new project, this is a topic called Theme.AppCompat.Light(even tough I chose Holo Light when creating a new project). So my question is: why does the android use this and what is it useful for? I tried changing it to android:Theme.Holo.Light, but it just gives me an error: java.lang.IllegalStateException: you need to use the Theme.AppCompat (or descendant) theme with this action.

I am using this configuration SDK: Android: minSdkVersion = "7" Android: targetSdkVersion = "18"

So my question is: why are you using AppCompat and what do I need to do so that my application can use the Holo theme.

My activity class is the only default one that is generated (it extends ActionBarActivity).

+4
source share
4 answers

Head topics were presented at API level 14.

Change android:minSdkVersion="7"toandroid:minSdkVersion="14"

If you want to keep it at a minimum, use this project to get Holo themes: HoloEverywhere

+3
source

This is because you are using SDK 7 (Android 2.1), which knows nothing about Holo. The Android team provides a compatibility theme that looks (almost) like Holo.

On the node side, you should switch to SKD 10, at least this will make your life a lot easier.

+2
source

. ActionBar API 11, , Google . Android Support Library , . Google , , .

+1

The default activity when creating a project is inherited from ActionBarActivity at the min api level of 15 or higher, I changed it to Activity and now my activity is inherited from Activity . Now I can change Holo or another theme. Probably inheriting from ActionBarActivity requires an appcompat theme.

0
source

All Articles