Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector image displaying wrong in Android

When I go to import a vector image using Android Vector Asset Studio, it becomes distorted, even in the preview. One of the vectors I was attempting to use was the photo outline straight from the Material site.

Here is what it is supposed to look like: enter image description here

This is what it looks like in Android: enter image description here

Here is one other example with what it's supposed to look like and then how it looks in Android: enter image description here enter image description here

If you want any other info let me know. Any help would be greatly appreciated.

like image 910
stripies Avatar asked Mar 21 '19 01:03

stripies


People also ask

Does SVG work on Android?

Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files into your project as vector drawable resources.

What are vector Drawables in Android?

A VectorDrawable is a vector graphic defined in an XML file as a set of points, lines, and curves along with its associated color information. The major advantage of using a vector drawable is image scalability.

Where do SVG files go on android?

You can import an SVG file as a VectorDrawable in Android Studio, follow these steps : "Right-click" on the res folder and select new > Vector Asset. Select the Local File option and browse to your . svg file.


1 Answers

use <androidx.appcompat.widget.AppCompatImageView instead of ImageView and also use app:srcCompat insted of android:src=

like image 191
mhKarami Avatar answered Sep 21 '22 17:09

mhKarami