我正在Android使用一个应用程序Toolbar,Custom style但当我正在运行该应用程序时,我收到以下错误:
引起:java.lang.IllegalStateException:此Activity已经有一个由窗口装饰提供的操作栏.不要在主题中请求Window.FEATURE_SUPPORT_ACTION_BAR并将windowActionBar设置为false以使用工具栏.
Styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColor">@color/textColorPrimary</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="android:textColorSecondary">@color/textColorPrimary</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="MyMaterialTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
<style name="MyEditTextTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Used for the bottom line when not selected / focused -->
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:colorBackground">@color/colorBackground</item>
<item name="android:textStyle">bold</item>
<item name="android:endColor">@color/colorPrimary</item> …Run Code Online (Sandbox Code Playgroud)