【问题标题】:VectorDrawable: Move the entire vector a few dp downVectorDrawable:将整个向量向下移动几个 dp
【发布时间】:2018-04-04 08:34:37
【问题描述】:

例如,我有来自 Android Studio 的ic_chat_black_24dp.xml 矢量资产,

<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"/>

我想要的是有起点M20,7,即开始图像5dp向下;所有的线路,一切。我可以将 ViewportHeight 更改为 29.0 以增强画布,但如何使用它?

我必须单独更改每个 Y axis 值还是有更快的方法?

【问题讨论】:

    标签: android android-vectordrawable


    【解决方案1】:

    您可以通过将整个路径包装在 &lt;group&gt; 标记中来移动整个路径,如下所示:

    <group
        android:translateY="5">
    
        <path
            ...your stuff.../>
    
    </group>
    

    该组还允许您更改the documentation 中列出的“缩放”和“旋转”属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-13
      • 2014-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多