1
votes

I understand that to correctly use some of the Material theme design patterns for pre API-21 devices, I'll have to include two style folders.

The theme is applied correctly on my Nexus 5 (lolipop) device, but when I run my application on a pre API-21 device (I'm using my Samsung Galaxy Note, API-16), I'm getting a blank, black screen. The application works, as I can interact with the activity (press buttons, use the keyboard, etc), but I can't see anything.

Here is my res/values-v21/themes.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.MyTheme" parent="AppTheme">

    <item name="colorPrimary">@color/green</item>
    <item name="colorPrimaryDark">@color/darkgreen</item>

</style>

</resources>

and here is my res/values/themes.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">

</style>
</resources>

and I've included this line inside my manifest file under <application>:

    android:theme="@style/Theme.MyTheme" 

Am I not supposed to use the AppCompat theme for pre-lolipop devices? I'm using the v7 support library.

Any help is appreciated.

1

1 Answers

1
votes

Change your res/values/themes.xml in:

<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">@color/green</item>
    <item name="colorPrimaryDark">@color/darkgreen</item>
</style>

Then remove the same theme (name="Theme.MyTheme") from res/values-v21/themes.xml