I tried to find out what could be the unit(dp,sp,px) of viewportWidth and viewportHeight in case VectorDrawable, but I didn't get any where unit of viewportWidth and viewportHeight. Below is what I got from Android documentation.
https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html
Can any one please help me.
viewportWidth
and viewportHeight
don't have physical units associated with them. This is because there isn't a meaningful unit you can associate with them, as a vector drawable will always be scaled to a physical size. The vector drawable's units in SVG speak are in the "user coordinate system," which means that the drawable's units are whatever units you are using to set the drawable's actual size.
The width
and height
define the default size of the vector drawable. These have meaningful units because that is the size the drawable will appear if you don't otherwise specify a size.
For example, if you have a vector drawable with a size of 50x50 dp, and the viewport size is 50x50, the "units" of the viewport size can be interpreted as dp because each "unit" of the drawable maps to a single dp.
Similarly, if the size of that drawable is 50x50 px, the "units" of the viewport are effectively px- each "unit" of the drawable will be a single pixel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With