Application启动背景图,冷启动,Activity全屏,悬浮窗悬浮
前序:网上一搜很多都是通过代码:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN| View.SYSTEM_UI_FLAG_LAYOUT_STATABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
等等。
经过我反复测验:style进行实现更加的完美。
如下:
<!-- Base application theme. -->
<style name="AppWelcomeTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 布局全屏,状态栏隐藏. 应用启动带有背景-->
<item name="android:windowBackground">@mipmap/welcome_bg</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="AppTranslucentTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 布局全屏,状态栏隐藏.-->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 布局全屏,状态栏悬浮之上. -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="AppFullscreenStatusTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- 布局全屏,状态栏悬浮. -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentStatus">true</item>
</style>