Application error when changing theme under styles

My android app:

Target API: 22

Min API: 15

Device Operation: API Level 22

I don't understand this concept of the whole topic,

In mine manifest.xml

I have installedandroid:theme="@style/AppTheme"

and all actions use this theme

Now I understand that they all use a theme called AppTheme

which I can now define by expanding other themes inside mystyles.xml

In my styles.xml

I have it

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>

      

I understand that themes AppCompat

allow us to use newer (e.g. material themes) older devices. I am running this app in API level 22 and API level 15, it works fine

Now that I change it to

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="android:Theme.Material">
        <!-- Customize your theme here. -->
    </style>

</resources>

      

It gives a warning saying this theme can only be used on API 21 or higher which is correct, now when I ignore the warning and run it on API 22 it crashes. Why?

Also I tried to parent AppTheme like Holo, Light etc., they all crash the app, why please explain?

All this causes the application to crash

<style name="AppTheme" parent="android:Theme.Translucent">
   <style name="AppTheme" parent="android:Theme.Holo">

      

Why don't they work, Holo was introduced 15 times?

I am using 22,

and could you please clarify the difference between Theme ....., BaseTheme ...., Android ..... themeName

And I am running android studio 1.3 and using the latest (Stable) SDK, SDK and SDK platforms. Thank!

+3


source to share


2 answers


Sorry, I encountered a problem. My Activity was extending AppCompatActivity instead of general activity, now I am getting it



+3


source


When you work with custom styles, you have to take care of the parents you provide. Try changing the parent theme and that might fix your problem.



0


source







All Articles