【问题标题】:vector path data in android studioandroid studio中的矢量路径数据
【发布时间】:2020-02-03 11:18:55
【问题描述】:

我已经通过矢量资产创建了一个新图标,但是一旦我将其复制并粘贴到下面的任何路径数据中 我在图标中的位置错误 我有一个粘贴 有什么帮助吗

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="360dp"
android:height="66dp"
android:viewportHeight="56.0"
android:viewportWidth="360.0">

<path
    android:name="home"
    android:pathData="M 70.1 27.6 C 69.1 27.6 68.1 27.6 67.1 27.6 C 67.1 30.267 67.1 32.933 67.1 35.6 C 65.433 35.6 63.767 35.6 62.1 35.6 C 62.1 33.6 62.1 31.6 62.1 29.6 C 60.767 29.6 59.433 29.6 58.1 29.6 C 58.1 31.6 58.1 33.6 58.1 35.6 C 56.433 35.6 54.767 35.6 53.1 35.6 C 53.1 32.933 53.1 30.267 53.1 27.6 C 52.1 27.6 51.1 27.6 50.1 27.6 C 53.5 24.6 56.8 21.6 60.1 18.6 C 63.4 21.6 66.8 24.6 70.1 27.6"
    android:strokeColor="#AAFFFFFF"
    android:strokeWidth="1" />

<path
    android:name="music"
    android:pathData="M 180 19 C 182 19 184 19 186 19 C 186 20.333 186 21.667 186 23 C 184.667 23 183.333 23 182 23 C 182 26.333 182 29.667 182 33 C 182 35.2 180.2 37 178 37 C 175.8 37 174 35.2 174 33 C 174 31.9 174.45 30.9 175.175 30.175 C 175.9 29.45 176.9 29 178 29 C 178.35 29 178.7 29.05 179.037 29.137 C 179.375 29.225 179.7 29.35 180 29.5 C 180 26 180 22.5 180 19"
    android:strokeColor="#AAFFFFFF"
    android:strokeWidth="1" />

<path
    android:name="heart"
    android:pathData="M 300.1 21.1 C 301.2 19.8 302.9 19 304.6 19 C 307.7 19 310.1 21.4 310.1 24.5 C 310.1 27.1 308.5 29.4 305.8 32 C 304.6 33.2 303.1 34.5 301.5 36 C 301.033 36.433 300.567 36.867 300.1 37.3 C 299.6 36.9 299.1 36.4 298.6 36 C 296.9 34.5 295.4 33.1 294.2 31.9 C 291.6 29.3 290.1 27 290.1 24.5 C 290.1 22.95 290.7 21.575 291.688 20.587 C 292.675 19.6 294.05 19 295.6 19 C 297.4 19 299.1 19.8 300.1 21.1"
    android:strokeColor="#AAFFFFFF"
    android:strokeWidth="1" />

<path
    android:name="selector"
    android:fillColor="#FFFFFF"
    android:pathData="M 70.1 27.6 C 69.1 27.6 68.1 27.6 67.1 27.6 C 67.1 30.267 67.1 32.933 67.1 35.6 C 65.433 35.6 63.767 35.6 62.1 35.6 C 62.1 33.6 62.1 31.6 62.1 29.6 C 60.767 29.6 59.433 29.6 58.1 29.6 C 58.1 31.6 58.1 33.6 58.1 35.6 C 56.433 35.6 54.767 35.6 53.1 35.6 C 53.1 32.933 53.1 30.267 53.1 27.6 C 52.1 27.6 51.1 27.6 50.1 27.6 C 53.5 24.6 56.8 21.6 60.1 18.6 C 63.4 21.6 66.8 24.6 70.1 27.6" />

<path
    android:name="clickable_home"
    android:pathData="M0,0h120v56h-120z" />

<path
    android:name="clickable_music"
    android:pathData="M120,0h120v56h-120z" />

<path
    android:name="clickable_heart"
    android:pathData="M240,0h120v56h-120z" />

【问题讨论】:

  • 您是否更改了以下任何参数:android:width、android:height、android:viewportHeight、android:viewportWidth?
  • 我把 android:height="66dp" 从 56dp 改成了
  • 你不应该这样做。您正在更改图像的初始大小,并且画布的绘图空间较小。
  • 即使改回来添加新图标时仍然无法解决问题,但位置错误
  • 请提供截图。

标签: java android android-studio


【解决方案1】:

这是错误位置的截图

之前 https://prnt.sc/qwtcefhttps://prnt.sc/qwtbx6

【讨论】:

    猜你喜欢
    • 2020-08-24
    • 2018-09-20
    • 1970-01-01
    • 2016-01-01
    • 1970-01-01
    • 2016-05-27
    • 2018-06-11
    • 2015-12-29
    • 1970-01-01
    相关资源
    最近更新 更多