在xml位图中调整图像大小 [英] Resize images in bitmap in xml
问题描述
我是Android编程的新手.最近,我开始一个项目,并想为Android应用程序创建启动画面.在遵循本教程之后,我已经阅读并成功实现了启动屏幕.但是,我意识到我的应用程序徽标会延伸到屏幕之外,如下所示:
I am new to Android programming. Recently, I had started on a project and would like to make a splash screen for the Android app. I had read and successfully implemented the splash screen after following this tutorial. However, I realise that my app logo stretches out of my screen, like this:
以下是我的background_splash.xml
:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/splash_background" />
<item>
<bitmap
android:gravity="center"
android:src="@drawable/tap" />
</item>
</layer-list>
我尝试过
android:width="75sp"
android:height="75sp"
,但它不起作用.因此,除了使用 in 只需更改 收件人 这篇关于在xml位图中调整图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!ImageView
之外,我想知道是否有一种方法可以调整图像的大小(最好没有Java代码).任何帮助将不胜感激!<bitmap>
but it does not work. Thus, I would like to know if there is a way to resize the image (without Java code, preferably) except for using an ImageView
. Any help would be appreciated!推荐答案
android:gravity="center"
android:gravity="fill"