Android应用的主题不是继承其父级主题

时间:2015-10-26 07:04:19

标签: android-theme android-styles

我有这种风格:

<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>

当然,在清单中我有:

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

我正在尝试按照本文实现材料设计工具栏:www.android4devs.com/2015/01/how-to-make-material-design-sliding-tabs.html#

现在,如果我将所有内容都保留在上面,我会得到:

  

java.lang.IllegalStateException:此Activity已经有一个动作   酒吧提供的窗户装饰。不要求   Window.FEATURE_ACTION_BAR并将windowActionBar设置为false   主题是使用工具栏。

但如果我改变我的风格:

 <!-- 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>

即,父项是直接Theme.AppCompat.Light.NoActionBar然后一切正常,没有错误消息。

谁能看到我错过了什么?为什么会这样?

0 个答案:

没有答案