1、去掉actionbar
2、添加style文件
<style name="Theme.FavDish.NoActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar"><item name="windowActionBar">false</item><item name="windowNoTitle">true</item></style>
2、
在mainfest中应用该style
android:theme="@style/Theme.FavDish.NoActionBar"
3、统一控制显示和隐藏actionbar
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.R){window.insetsController?.hide(WindowInsets.Type.statusBars())}else{@Suppress("DEPRECATION")window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)}
4、运行结果:
本文发布于:2024-02-05 05:09:17,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170724880163319.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |