在ImageView中缩放可重复的位图

时间:2019-12-05 09:15:29

标签: android xml bitmap imageview

我有一个带有以下代码的可绘制repeatable_stencil.xml

<?xml version="1.0" encoding="utf-8"?>
<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/stencil"
    android:tileMode="repeat"/>

然后在这样的ImageView中使用它:

   <ImageView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/repeatable_stencil"
    />

设置我的imageview的方式应该用repeatable_stencil填充其父视图。它确实可以完成工作,但是不正确。

stencil图像的像素约为2500 x 4000。但是,当像我上面那样使用它时,位图会自动缩放,stencil图像会超级缩放。

我想将其缩小到自定义尺寸。

0 个答案:

没有答案