androidx使用Toolbar
- 将默认标题栏改为隐藏状态

<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/colorAccent</item>
</style>
</resources>
2.修改默认布局文件代码

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="htt

本文介绍了在AndroidX中使用Toolbar的方法。首先将默认标题栏隐藏,接着修改默认布局文件代码,在res目录下创建menu文件夹并修改其中toolbar.xml内容,然后修改MainActivity内代码,最后展示了使用Toolbar的最终效果。

186

被折叠的 条评论
为什么被折叠?



