Fliping Drawable Image in Vector Drawable

后端 未结 1 1656
花落未央
花落未央 2021-01-07 18:34

I have found this vector drawable resource here. What I would like to do is flip it so the X is on the other side.

I managed to do this in the layo

相关标签:
1条回答
  • 2021-01-07 18:53

    You were almost doing it, just with the wrong pivot point.

    It needs to flip around the centre of the image, so looking at the viewport the full width is 24, so the pivot point needs to be at 12.

    <vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportHeight="24"
        android:viewportWidth="24">
    
        <group
            android:name="rotationGroup"
            android:pivotX="12"
            android:scaleX="-1" >
    
            <path
                android:fillColor="#FFFFFF"
                android:pathData="M15,14C17.67,14 23,15.33 23,18V20H7V18C7,15.33 12.33,14 15,14M15,12A4,4 0 0,1 11,8A4,4 0 0,1 15,4A4,4 0 0,1 19,8A4,4 0 0,1 15,12M5,9.59L7.12,7.46L8.54,8.88L6.41,11L8.54,13.12L7.12,14.54L5,12.41L2.88,14.54L1.46,13.12L3.59,11L1.46,8.88L2.88,7.46L5,9.59Z" />
        </group>
    </vector>
    
    0 讨论(0)
提交回复
热议问题