如何调整可绘制图层列表中的位图大小?程序化或XML格式

问题描述 投票:1回答:1

我正在尝试像https://medium.com/@ssaurel/create-a-splash-screen-on-android-the-right-way-93d6fb444857这样正确地构建启动画面,因为我必须将我的应用程序图标.png文件放置在可绘制图层列表中,像这样的位图

<item
    android:drawable="@color/gray"/>

<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/logo"/>
</item>

现在如何调整此位图的大小?谢谢...

java android xml android-layout bitmap
1个回答
0
投票

无法通过XML重置新的调整大小,并且您可以确认此link

在编码方法中,有许多不同且复杂的方法。如果您想了解更多,可以查看此question

但是如果您的目标只是更改大小,可以通过ImageView]完成>

如果要将完整图像设置为使用match_parent进行图像查看的屏幕(最适合初始屏幕):

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitXY"
                android:layout_centerInParent="true"
                android:src="@drawable/splash_screen" />

        </RelativeLayout>
© www.soinside.com 2019 - 2024. All rights reserved.