繁体   English   中英

在 Android 上创建全屏图像以填充启动画面

[英]Create full screen image on Android to fill the splash screen

我是 Android 编程的新手,试图用图像创建启动画面。 目前我有这个代码:

<?xml version="1.0" encoding="utf-8"?>

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">

<item>
    <bitmap
        android:src="@drawable/splash"
        android:gravity="fill"/>
</item>

</layer-list>

我得到的这个结果是一个居中的图像,顶部和底部都是空白的。

我尝试了多个常量,如中心、填充、填充 _horizontal 等。还尝试用 ImageView 替换 bitmap,但我认为我需要更多了解如何正确使用它。

我正在尝试使图像像这样填充屏幕:

在此处输入图像描述

使用以下ImageView作为参考,您缺少scaleType属性

<ImageView
          android:id="@+id/certImage"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:src="@drawable/image"
          android:scaleType="centerCrop" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM