首先只有Android4.4也就是api19及以上才可以使用沉浸式状态栏。
第一步:在res目录下新建一个values-v19文件夹
新建一个style.xml,添加代码
<resources
<style name=
"AppBaseTheme"
parent=
"android:Theme.Holo.Light.NoActionBar.TranslucentDecor"
type=
"text/css"
>
</style>
</resources>
第二步:在沉浸式布局父布局添加这两个属性
android:clipToPadding=
"true"
android:fitsSystemWindows=
"true"
自此完成沉浸式标题栏