Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VectorDrawable: Move the entire vector a few dp down

For example, I have ic_chat_black_24dp.xml vector asset from Android Studio,

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="#FF000000"
    android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM6,9h12v2L6,11L6,9zM14,14L6,14v-2h8v2zM18,8L6,8L6,6h12v2z"/>

What I want is to have the start point M20,7 i.e. start the image 5dp down; all lines, everything. I can change the ViewportHeight to 29.0 to enhance the canvass but how do I use it?

Do I have to change each Y axis value individually or there's a faster way?

like image 730
user3697098 Avatar asked Apr 04 '18 08:04

user3697098


1 Answers

You can move the entire path by wrapping it in a <group> tag, which would look something like:

<group
    android:translateY="5">

    <path
        ...your stuff.../>

</group>

The group also allows you to change 'scale' and 'rotation' properties as listed in the documentation.

like image 186
Lewis McGeary Avatar answered Oct 04 '22 19:10

Lewis McGeary