打开AndroidManifest.xml文件
android:theme="@style/AppTheme" 点击AppTheme
在原有的代码的item下面家两行代码
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
如果想去除标题的话把这个原来的
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">改成
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
最简单的方式,直接透明标题栏沉浸式在Activity的setContentView(R.layout.
activity_main)
;上面添加下面这句话getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
转载请注明原文地址: https://www.6miu.com/read-64994.html