Removing the default toolbar in an activity android

 ̄綄美尐妖づ 提交于 2019-12-25 00:14:48

问题


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.


回答1:


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>



回答2:


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>


来源:https://stackoverflow.com/questions/52358998/removing-the-default-toolbar-in-an-activity-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!