Hi I am building one android sample application with some material design concepts. I started with https://developer.android.com/training/material/theme.html. I am using eclipse. I have added appcompat_7 support library in library section of my project.Then When I try to apply following theme.
<style name="AppTheme" parent="@android:style/Theme.Material.Light">
</style>
It gives me following run time error:
11-12 11:32:30.416: E/AndroidRuntime(21375): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.androidmaterialdesignapi/com.example.androidmaterialdesignapi.MainActivity}:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
My activity extends ActionBarActivity
. Am I doing anything wrong. Need some help. Thank you. Is there any good example to learn material design?
Yes when you use ActionBar activity as parent activity you need to have Theme.AppCompat as your parent style for your customized theme.
Replace your line as follows:
<style name="AppTheme" parent="@style/Theme.AppCompat">
instead of this
<style name="AppTheme" parent="@android:style/Theme.Material.Light">
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With