问题描述
限时送ChatGPT账号..是否可以创建带有徽标的闪屏,该徽标可以保持其纵横比,而背景图像可以独立调整大小?我目前正在使用几个不同分辨率的 .png 文件,它们在大多数设备上看起来都很棒.但是,有一些手机严重扭曲了我的徽标(即三星 S8,具有移动垂直屏幕空间).
Is it possible to create a splash screen with a logo that maintains its aspect ratio while the background image can be resized independently? I'm currently using several .png files for different resolutions and they look great on most devices. However, there are a few phones that distort my logo severely (i.e. the Samsung S8, with move vertical screen space).
我可以处理启动画面背景的一些失真,但窄/压扁的徽标是不可接受的.有谁知道如何做到这一点?对于新布局,矢量可绘制徽标会比 .png 更好吗?
I can deal with some distortion for my splash screen background, but the skinny/squashed logo is unacceptable. Does anyone know how to do this? And would a vector drawable logo be better than a .png for the new layout?
推荐答案
如果您的启动画面只有纵向图像,这里有一个解决方案,它是纵向全屏,居中但不裁剪 edit:
纵向横向:
If you only have a portrait image for your splash screen, here's a solution which is full screen on portrait, and centred but not cropped on edit:
portrait landscape:
splash_screen.xml:
splash_screen.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android/apk/res/android"
android:id="@+id/layoutSplash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/splash_screen_background">
<ImageView
android:contentDescription="@string/splash_screen_description"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
style="@style/SplashScreen" />
</LinearLayout>
值/样式.xml
<style name="SplashScreen">
<item name="android:src">@drawable/splash</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">fitCenter</item>
</style>
values-port/styles.xml
values-port/styles.xml
<style name="SplashScreen">
<item name="android:src">@drawable/splash</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">centerCrop</item>
</style>
这篇关于没有标志失真的Android启动画面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论