Removing the default toolbar in an activity androi

2019-08-23 11:10发布

Before upgrading to android 3.1.I usually just change the theme to a theme. app compact. NoTitleBar but the new version of android studio is having errors recognizing it.I solved this problem by adding base to the beginning. But I can seem to find any answer regarding a style theme that supports removing the custom bar.

2条回答
相关推荐>>
2楼-- · 2019-08-23 11:21
Add this style in style file . where other styles are mentioned . 


<!-- Base application theme. -->
<style name="AppThemeNoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimaryDark</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorPrimaryDark</item>
    <item name="android:statusBarColor">@color/lightgreycolor</item>
</style>
查看更多
淡お忘
3楼-- · 2019-08-23 11:35

In your res/values/styles.xml you have this similar block of code. Ensure that you use Theme.AppCompat.Light.NoActionBar as parent of your theme

<!-- 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/colorAccent</item>
</style>
查看更多
登录 后发表回答