自动调整初始屏幕图像

Autofit splash screen image

这是我在 "activity_splash_screen.xml" 文件中使用的代码。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context="com.taleshi.fartal.Activities.SplashScreenActivity">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/splashscreen"
    android:scaleType="fitXY"/>

这是我的应用程序。 https://play.google.com/store/apps/details?id=com.taleshi.fartal

我已将 1280x1920、960x1600、720x1280、480x800 和 320x480 启动画面图像添加到启动画面文件夹。我不确定为什么图像没有自动适合不同的设备!它在我的索尼设备上看起来很奇怪,但在 Android Studio 中的虚拟设备 "Nexus 5X API 26" 上看起来不错!

这里的修复是什么。感谢任何帮助。 干杯!

在你的项目目录的res文件夹下创建以下文件夹:
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxxhdpi
将 320 x 480 图像放在 drawable-mdpi 文件夹下
将 480 x 800 图像放在 drawable-hdpi 文件夹下
将 720 x 1280 图像放在 drawable-xhdpi 文件夹下
将 960 x 1600 图像放在 drawable-xxhdpi 文件夹下
将 1280 x 1920 图像放在 drawable-xxxhdpi 文件夹下
接下来,将所有图像重命名为具有相同的文件名,然后重新运行您的应用程序。