简体   繁体   English

缩放后Android svg模糊?

[英]Android svg blurred after scaling?

First I imported a svg file into the drawable folder using the android studio Vector Asset wizard successfully. 首先,我成功使用android studio矢量资产向导将svg文件导入了drawable文件夹。 In the layout file I added an ImageView used the file I previously imported as "src": 在布局文件中,我添加了一个ImageView,使用了以前导入为“ src”的文件:

<ImageView
    android:id="@+id/idx_logo_btm"
    android:layout_width="75dp"
    android:layout_height="40dp"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_logo_round" />

Then I scaled it to a bigger size, the image looks very well in the android studio Live Layout editor, but after deploying it to my device the image looks blurred just like bitmap. 然后我将其缩放到更大的尺寸,该图像在android studio Live Layout编辑器中看起来很好,但是在将其部署到我的设备后,该图像看起来就像位图一样模糊。 Is it because my device version is very low (4.4.2) or we can not scale svg? 是因为我的设备版本太低(4.4.2)还是无法扩展svg?

You have to use 你必须用

    app:srcCompat="@drawable/ic_logo_round"

when supporting pre API 21 versions. 支持API 21之前的版本。 More informations on this topic here: Android: What is the difference between app:srcCompat=" " and android:src=" "? 有关此主题的更多信息,请参见Android:app:srcCompat =“和android:src =”“有什么区别?

Try using android:scaleType="fitXY" or "centerCrop" 尝试使用android:scaleType =“ fitXY”或“ centerCrop”

   <ImageView
        android:layout_width="75dp"
        android:layout_height="40dp"
        android:scaleType="fitXY"
        android:src="@drawable/ic_logo_round" />

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

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