【发布时间】:2018-03-09 23:30:59
【问题描述】:
我有我的徽标的 .svg 文件。我使用 android studio 中的矢量资源将 svg 文件转换为 xml 文件。现在,当我在图像视图中使用 xml 文件时。具有 Nougat 的设备可以完美显示图像,但具有 Marshmallow 及更低版本的设备显示不同的图像。
这就是它的外观以及它在装有 Android Nougat 的设备中的显示方式
但这就是它在装有 Android Marshmallow 的设备上的外观。
这是我的 xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="100dp"
android:src="@drawable/ic_logo"
android:layout_marginLeft="@dimen/margin_20"
android:layout_marginRight="@dimen/margin_20"
android:scaleType="fitXY"
/>
<TextView
android:id="@+id/tvOnlineTailor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/text"
android:textColor="@color/black"
android:textSize="20sp"
android:gravity="center"
/>
</LinearLayout>
</RelativeLayout>
如何解决这个问题? 我知道我可以使用 png 图像而不是 xml 文件,但我不希望图像像素化。
提前致谢。
【问题讨论】:
-
你能分享你的 ImageView XML 吗?
标签: android image imageview android-6.0-marshmallow android-7.0-nougat