Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Vector drawable from psd has empty preview

I was trying to add a vector drawable to Android studio Using the vector asset in Android studio, I've imported a psd file, it but it seems like there is a rendering problem as the preview and the result xml file are empty, please check the output xml screenshot. enter image description here

like image 253
S qasem Avatar asked Nov 01 '16 10:11

S qasem


People also ask

Does Android support SVG images?

SVG, the default vector image representation format for many platforms has been developed by the World Wide Web Consortium (W3C) since 1999. The SVG format still isn't currently supported by Android (though read on below to learn of a workaround using Google's Vector Asset Studio).

What is Android PathData?

PathData in vector images android is Vector graphic program's script. It is not exactly clean and human readable code as a high priority.


1 Answers

In your screenshot there is no pathdata in the file. Hence, nothing is drawn on screen. I am showing contents of a VectorDrawable xml file. Copy the contents into a blank xml file in android studio and see the shape drawn in blue on screen.

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="600dp"
        android:height="600dp"
        android:viewportWidth="800.0"
        android:viewportHeight="800.0">

    <path
        android:pathData="M  162   8
        q    -07    00   -41    26
        q    -34    27   -50    64
        q    -25    59   -19   117
        q     07    70    53   121
        q     57    63   151    62
        q     87   -01   140   -66
        q     46   -55    48  -142
        q     01   -56   -34  -105
        q    -38   -52   -77   -70
        l    -29   -11
        q     16   -01    31   -02
        q     59   -01   119   -02






             "

        android:strokeLineCap="round"
        android:strokeColor="#f00f"
        android:fillColor="#00000000"
        android:strokeWidth="32"/>



</vector>
like image 90
Vempati Satya Suryanarayana Avatar answered Oct 12 '22 23:10

Vempati Satya Suryanarayana