停止启动画面到导航栏下方
Stopping Splash Screen to go under the navigation bar
我想使用这个闪屏,但它一直在导航栏下面。
Splash img
如何在保留导航栏的同时强制它适应屏幕?
<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen">
<item name="android:windowBackground">@drawable/splash</item>
</style>
将此添加到启动画面的 xml 文件中 activity。
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash"/>
</FrameLayout>
找到一个解决方案
<item name="android:windowBackground">@drawable/splash</item>
到
<item name="android:background">@drawable/splash</item>
您的@drawable/splash
应该看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/black"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/your_image" />
</item>
我想使用这个闪屏,但它一直在导航栏下面。
Splash img
如何在保留导航栏的同时强制它适应屏幕?
<style name="splashScreenTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar.Fullscreen">
<item name="android:windowBackground">@drawable/splash</item>
</style>
将此添加到启动画面的 xml 文件中 activity。
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash"/>
</FrameLayout>
找到一个解决方案
<item name="android:windowBackground">@drawable/splash</item>
到
<item name="android:background">@drawable/splash</item>
您的@drawable/splash
应该看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/black"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/your_image" />
</item>