Actionbar With Appcompat Library V7 (ava.lang.illegalstateexception: You Need To Use A Theme.appcompat Theme)
I want to implement an ActionBar with the Android v7 appcompat library to support the ActionBar for Android >= 2.1 My app starts with the MainActivity which contains a dark Acti
Solution 1:
Replace @android:style/Theme.Holo.Light.DarkActionBar
in your AndroidManifest.xml with @style/Theme.AppCompat.Light.DarkActionBar
Make sure that you have the following dependency in your build.gradle: compile 'com.android.support:appcompat-v7:22.1.1'
Edit: Check the first comment by Knossos too!
Solution 2:
If you are extending ActionBarActivity
in your MainActivity
, you will have to change the parent theme in values-v11
also.
So the style.xml
in values-v11
will be -
<?xml version="1.0" encoding="utf-8"?><resources><stylename="QueryTheme"parent="@style/Theme.AppCompat"><!-- Any customizations for your app running on devices with Theme.Holo here --></style></resources>
and Make sure you replace @android:style/Theme.Holo.Light.DarkActionBar
in your AndroidManifest.xml
with @style/Theme.AppCompat.Light.DarkActionBar
Post a Comment for "Actionbar With Appcompat Library V7 (ava.lang.illegalstateexception: You Need To Use A Theme.appcompat Theme)"