1

I created ImageView with VectorDrawable. In an android emulator all works properly, but in my phone an image is pixelated.

<ImageView
    android:id="@+id/image_circle_hello"
    android:layout_width="50dp"
    android:layout_height="50dp"
    android:contentDescription="@string/hello"
    android:src="@drawable/ic_circle"
    android:layout_gravity="center_horizontal" />
  • This should help you: [https://stackoverflow.com/questions/37271025/vectordrawable-image-becomes-pixelated](https://stackoverflow.com/questions/37271025/vectordrawable-image-becomes-pixelated) – tscheppe Aug 28 '19 at 09:35

2 Answers2

1

If your device version API less than 21, you must add this line to defaultConfig in Gradle:

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

And also you must use app:srcCompat="@drawable/ic_circle" instead of android:src="@drawable/ic_circle".

Matthew Strukov
  • 341
  • 1
  • 8
1

Change

android:src="@drawable/ic_circle"

to

app:srcCompat="@drawable/ic_circle"
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77