[英]How can I resize image in pub package "flutter_native_splash"?
I am using flutter_native_splash 1.3.1 package to add splash screen to the app.我正在使用 flutter_native_splash 1.3.1 package 向应用程序添加启动画面。
The image size is getting displayed bigger than the desired size on the splash screen.图像大小在初始屏幕上显示大于所需大小。 What is right approach to decrease the size of the image on the splash screen?
减小初始屏幕上图像大小的正确方法是什么?
Unfortunately, I don't think you can do it.不幸的是,我认为你做不到。 So the option is to resize your image to fit your screen.
因此,选项是调整图像大小以适合您的屏幕。 You can read about the resolution in this topic https://github.com/jonbhanson/flutter_native_splash/issues/89
您可以阅读本主题中的解决方案https://github.com/jonbhanson/flutter_native_splash/issues/89
It is stated in the documentation that the image will be stretched to fit the screen.文档中说明图像将被拉伸以适应屏幕。 I think the best solution is to make your image with an aspect ratio of 9x16 (portrait) so the proportions stay the same.
我认为最好的解决方案是使图像的纵横比为 9x16(纵向),这样比例保持不变。
I was having issues with this.我遇到了这个问题。 I tried a lot of different suggestions from stackoverflow, but nothing worked.
我从stackoverflow尝试了很多不同的建议,但没有任何效果。 I eventually just added padding within the image around the logo I wanted to display.
我最终只是在我想要显示的徽标周围的图像中添加了填充。 So the logo was about 1/3 of the image, centered in the middle and then used center for gravity
所以徽标大约是图像的 1/3,居中居中,然后使用中心作为重心
<bitmap android:gravity="center" android:src="@drawable/splash" />
The images are all called splash.png.这些图像都称为 splash.png。
The images sizes were all squares and had the dimensions:图像尺寸均为正方形,尺寸为:
hdpi 192X192,
xhdpi 288X288,
xxhdpi 384X384,
xxxhdpi 1024X1024
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.