I'm new to this Android development, and I find the layout of it really confusing. I'm trying to have a background image on a view, and I've tried using this example Add a background image to shape in xml Android, but it looks very bad (bitmaps you know)
So I thought vectors could be fun. Only problem is that I cannot get even the official examples to work. I've tried setting this as a background
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="256dp"
android:width="256dp"
android:viewportWidth="32"
android:viewportHeight="32">
<path android:fillColor="#8fff" android:pathData="M20.5,9.5
c-1.955,0,-3.83,1.268,-4.5,3
c-0.67,-1.732,-2.547,-3,-4.5,-3
C8.957,9.5,7,11.432,7,14
c0,3.53,3.793,6.257,9,11.5
c5.207,-5.242,9,-7.97,9,-11.5
C25,11.432,23.043,9.5,20.5,9.5z" />
It renders in the design view and all, but the attributes viewportWidth
, viewportHeight
, fillColor
and pathData
all show the same warning:
The 'http://schemas.android.com/apk/res/android:viewportWidth' is not declared
If I check the file, sure enough, it's not there. Does that mean I have to explicitly declare all those types? It seems a bit odd for vanilla examples.
Note that if I remove the 'android' in front of the warnings, it will remove warnings but still give me the same deployment error
Android.Views.InflateException: Binary XML file line #1: Error inflating class <unknown>