2020.09.01.
Xamarin.Android – Using SVG Images, VectorDrawable
By default, Android does not support svg. For this, they invented VectorDrawable, which can display svgs.
First step: create a Xamarin.Android Project. Go to Main.xml and paste this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/image"
/>
</LinearLayout>
Yes, we will use VestorDrawable as a normal Image (png).
After that we have to create a VectorDrawable. Create a svg image. And download it.
Paste this svg file to: http://inloop.github.io/svg2android/. Download this xml and paste this file to our project to the Resource/drawable folder for example. Rename this file to image.xml, and that’s all. If we run the application, this will be visible as a VesctorDrawable (svg).
VERY VERY IMPORTANT: in your svg image, don’t use shadow and gradient!!! This can’t be visible and convertable as VectorDrawable!