Reputation: 2443
I added a user svg image from this website. The image should be sharp, but when i use it in my app as a default user image it is very blurry.
<!-- Thumbnail Image -->
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/thumbnail"
android:background="@drawable/ic_icon_user"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="8dp" />
Also how would I edit a svg image color in android. I tried adding a custom color, but it didn't work.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="@color/ColorRed"
android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,14C16.42,14 20,15.79 20,18V20H4V18C4,15.79 7.58,14 12,14Z" />
</vector>
Upvotes: 8
Views: 5451
Reputation: 1256
Well similar problem happened to me. I was using
app:srcCompat="@drawable/your_image".
Turns out this was causing the problem. You need to change it to this:
android:src="@drawable/your_image".
Upvotes: 1
Reputation: 49
In Android Manifest.xml, set for your activity (blur doesn't work when hardware acceleration is true)
android:hardwareAccelerated="false"
You can disable hardware acceleration on the VIEW level:
myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Upvotes: 1
Reputation: 221
Adding this to app build.gradle
helped me to fix the problem with blurry svg images:
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
Upvotes: 10