0

I am having this style:

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">

</style>

<!-- Application theme. -->
<style name="MyAppTheme" parent="AppBaseTheme">

    <!-- All customizations that are NOT specific to a particular API-level can go here. -->


</style>

Of course, in the manifest I have:

   <application
        android:name=".MyAppApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/MyAppTheme" >

I am trying to implement material design toolbar following this article: www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html#

Now, if I'm leaving everything as above, I get:

java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.

But if I'm changing my style to this:

 <!-- Application theme. -->
<style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <!-- All customizations that are NOT specific to a particular API-level can go here. -->


</style>

i.e., the parent is directly Theme.AppCompat.Light.NoActionBar then everything works without the error message.

Can anyone see what am I missing? why is that so?

dsb
  • 2,347
  • 5
  • 26
  • 43
  • Could I see your activity code? – Nick Hargreaves Oct 26 '15 at 07:07
  • @NickHargreaves Sure Nick, you can see it in the SO question here: http://stackoverflow.com/questions/33254840/why-do-android-insists-that-i-already-have-action-bar . Changing the parent theme was the solution I found to my problem there. However, it still puzzles me. Thank you very much. – dsb Oct 26 '15 at 07:21

0 Answers0