没有标志失真的Android启动画面

编程入门 行业动态 更新时间:2024-10-22 16:42:38
本文介绍了没有标志失真的Android启动画面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-23 02:58:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1034387.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:画面   标志   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!