i have tried to use android:Theme.Material.Ligh
in my values-v21/styles.xml
and my activity extends AppCompatActivity
, which android didnt allow and got error saying 'IllegalStateException:You need to use a Theme.AppCompat theme (or descendant) with this activity
'
So i went through different threads on stackoverflow where people have discussed about this same error and i got little bit of clarity but couldn't exactly understood when we can use android:Theme.Material.Ligh
theme in our activity and when we can't use it.
For my app minSdkVersion
is 15 and targetSdkVersion
is 24
Asked
Active
Viewed 503 times
-3

hemkar
- 27
- 1
- 6
-
try changing min sdk verison to 16 – Ankush Bist Jan 13 '17 at 04:08
-
Change the Java inheritance from AppCompatActivity to Activity and use it – Charuක Jan 13 '17 at 04:31
-
Just use `Theme.AppCompat.Light`. – ianhanniballake Jan 13 '17 at 04:59
1 Answers
0
make sure AppTheme
in your values/style.xml
also uses AppCompat theme
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

Jayanth
- 5,954
- 3
- 21
- 38