Inkscape导入的SVG无法渲染

时间:2018-05-11 19:38:28

标签: android vector-graphics inkscape

从Inkscape导入的SVG无法在Android Studio中呈现。我不知道怎么开始麻烦拍这个。 xml代码中是否有任何提示为什么?

    <?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="10dp"
    android:viewportWidth="188.56328"
    android:viewportHeight="80.877213">

    <path
        android:strokeColor="#2cb71a"
        android:strokeWidth="2.05815887"
        android:strokeLineJoin="round"
        android:pathData="M-185.37,134.151 L-0.63217,134.151 L-0.63217,213.584 L-185.37,213.584 L-185.37,134.151 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-34.9949,145.281 C-32.1268,145.281,-29.8018,147.606,-29.8018,150.475 C-29.8018,153.343,-32.1268,155.668,-34.9949,155.668 C-37.863,155.668,-40.188,153.343,-40.188,150.475 C-40.188,147.606,-37.863,145.281,-34.9949,145.281 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.42433667"
        android:strokeLineJoin="round"
        android:pathData="M-35.1156,156.996 L-34.8741,156.996 Q-26.7825,156.996,-26.7825,165.088 L-26.7825,177.889 Q-26.7825,185.981,-34.8741,185.981 L-35.1156,185.981 Q-43.2073,185.981,-43.2073,177.889 L-43.2073,165.088 Q-43.2073,156.996,-35.1156,156.996 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-104.59,121.139 L-104.59,121.139 Q-102.235,121.139,-102.235,123.494 L-102.235,133.155 Q-102.235,135.51,-104.59,135.51 L-104.59,135.51 Q-106.945,135.51,-106.945,133.155 L-106.945,123.494 Q-106.945,121.139,-104.59,121.139 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M128.593,104.735 L128.593,104.735 Q130.948,104.735,130.948,107.09 L130.948,116.752 Q130.948,119.107,128.593,119.107 L128.593,119.107 Q126.238,119.107,126.238,116.752 L126.238,107.09 Q126.238,104.735,128.593,104.735 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-169.218,-6.47664 L-169.218,-6.47664 Q-166.863,-6.47664,-166.863,-4.12162 L-166.863,5.54001 Q-166.863,7.89503,-169.218,7.89503 L-169.218,7.89503 Q-171.573,7.89503,-171.573,5.54001 L-171.573,-4.12162 Q-171.573,-6.47664,-169.218,-6.47664 Z" />
    <path
        android:fillColor="#2cb71a"
        android:fillAlpha="0.48387098"
        android:strokeAlpha="0.48387098"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-173.866,-7.92172 L-173.866,-7.92172 Q-171.511,-7.92172,-171.511,-5.5667 L-171.511,4.09493 Q-171.511,6.44995,-173.866,6.44995 L-173.866,6.44995 Q-176.221,6.44995,-176.221,4.09493 L-176.221,-5.5667 Q-176.221,-7.92172,-173.866,-7.92172 Z" />
    <path
        android:fillColor="#2cb71a"
        android:fillAlpha="0.98999999"
        android:strokeAlpha="0.98999999"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-107.292,124.489 L-107.292,124.489 Q-104.937,124.489,-104.937,126.844 L-104.937,136.505 Q-104.937,138.86,-107.292,138.86 L-107.292,138.86 Q-109.647,138.86,-109.647,136.505 L-109.647,126.844 Q-109.647,124.489,-107.292,124.489 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round"
        android:pathData="M-70.6076,172.683 L-71.0429,172.683 Q-68.4702,172.683,-68.4702,175.256 L-68.4702,185.811 Q-68.4702,188.383,-71.0429,188.383 L-70.6076,188.383 Q-73.1803,188.383,-73.1803,185.811 L-73.1803,175.256 Q-73.1803,172.683,-70.6076,172.683 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round"
        android:pathData="M19.419,-211.623 L18.9836,-211.623 Q21.5563,-211.623,21.5563,-209.051 L21.5563,-198.496 Q21.5563,-195.923,18.9836,-195.923 L19.419,-195.923 Q16.8462,-195.923,16.8462,-198.496 L16.8462,-209.051 Q16.8462,-211.623,19.419,-211.623 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round"
        android:pathData="M-83.4017,169.639 L-83.8371,169.639 Q-81.2644,169.639,-81.2644,172.212 L-81.2644,182.766 Q-81.2644,185.339,-83.8371,185.339 L-83.4017,185.339 Q-85.9744,185.339,-85.9744,182.766 L-85.9744,172.212 Q-85.9744,169.639,-83.4017,169.639 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round"
        android:pathData="M-133.339,-163.758 L-133.774,-163.758 Q-131.202,-163.758,-131.202,-161.186 L-131.202,-150.631 Q-131.202,-148.058,-133.774,-148.058 L-133.339,-148.058 Q-135.912,-148.058,-135.912,-150.631 L-135.912,-161.186 Q-135.912,-163.758,-133.339,-163.758 Z" />
    <path
        android:fillType="evenOdd"
        android:strokeColor="#000000"
        android:strokeWidth="0.12077035"
        android:pathData="M-71.2256,158.659 C-68.039,153.392,-64.1607,154.191,-64.0522,154.218" />
    <path
        android:fillType="evenOdd"
        android:strokeColor="#000000"
        android:strokeWidth="0.12077035"
        android:pathData="M-68.8345,158.232 C-67.756,156.715,-66.4003,155.521,-63.9668,155.585" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.42433643"
        android:strokeLineJoin="round"
        android:pathData="M-179.123,159.942 C-181.165,159.946,-183.173,160.725,-184.698,162.189 L-184.578,162.189 C-184.411,162.189,-184.276,162.324,-184.276,162.491 L-184.276,186.524 C-184.276,186.598,-184.304,186.665,-184.347,186.717 C-182.371,186.293,-180.55,185.131,-179.329,183.313 L-172.19,172.687 C-169.69,168.966,-170.673,163.958,-174.394,161.458 L-174.595,161.323 C-175.99,160.386,-177.567,159.938,-179.124,159.941 Z M-187.12,186.827 C-186.402,186.924,-185.678,186.922,-184.968,186.827 Z" />
    <path
        android:fillColor="#2cb71a"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round"
        android:pathData="M-168.567,153.011 C-165.699,153.011,-163.374,155.336,-163.374,158.204 C-163.374,161.072,-165.699,163.397,-168.567,163.397 C-171.435,163.397,-173.76,161.072,-173.76,158.204 C-173.76,155.336,-171.435,153.011,-168.567,153.011 Z" />
    <path
        android:fillColor="#ff0000"
        android:strokeColor="#ffcc00"
        android:strokeWidth="0.26458332"
        android:pathData="M-228.855,129 L-227.806,129 L-227.806,130.313 L-228.855,130.313 Z M-228.855,122.597 L-227.806,122.597 L-227.806,125.982 L-227.909,127.827 L-228.746,127.827 L-228.855,125.982 Z" />
    <path
        android:fillColor="#ff0000"
        android:strokeColor="#ffcc00"
        android:strokeWidth="0.26458332"
        android:pathData="M-228.855,129 L-227.806,129 L-227.806,130.313 L-228.855,130.313 Z M-228.855,122.597 L-227.806,122.597 L-227.806,125.982 L-227.909,127.827 L-228.746,127.827 L-228.855,125.982 Z" />
    <path
        android:fillColor="#ff0000"
        android:strokeColor="#ffcc00"
        android:strokeWidth="0.26458332"
        android:pathData="M-228.855,129 L-227.806,129 L-227.806,130.313 L-228.855,130.313 Z M-228.855,122.597 L-227.806,122.597 L-227.806,125.982 L-227.909,127.827 L-228.746,127.827 L-228.855,125.982 Z" />
</vector>

是否有任何提示可以帮助解决问题?我可以在inkcape中做些什么来确保在Android Studio中呈现文件吗?

1 个答案:

答案 0 :(得分:0)

看起来它没有很好的形成,有很多负面的坐标。

检查出没有负坐标和更大的尺寸:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="240dp"
    android:height="100dp"
    android:viewportWidth="400"
    android:viewportHeight="200">
    <path
        android:pathData="M185.37,134.151 L0.63217,134.151 L0.63217,213.584 L185.37,213.584 L185.37,134.151 Z"
        android:strokeWidth="2.05815887"
        android:strokeColor="#2cb71a"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M34.9949,145.281 C32.1268,145.281,29.8018,147.606,29.8018,150.475 C29.8018,153.343,32.1268,155.668,34.9949,155.668 C37.863,155.668,40.188,153.343,40.188,150.475 C40.188,147.606,37.863,145.281,34.9949,145.281 Z"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M35.1156,156.996 L34.8741,156.996 Q26.7825,156.996,26.7825,165.088 L26.7825,177.889 Q26.7825,185.981,34.8741,185.981 L 35.1156,185.981 Q 43.2073,185.981, 43.2073,177.889 L 43.2073,165.088 Q43.2073,156.996,35.1156,156.996 Z"
        android:strokeWidth="2.42433667"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M104.59,121.139 L104.59,121.139 Q102.235,121.139,102.235,123.494 L102.235,133.155 Q102.235,135.51,104.59,135.51 L104.59,135.51 Q 106.945,135.51,106.945,133.155 L106.945,123.494 Q106.945,121.139,104.59,121.139 Z"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M128.593,104.735 L128.593,104.735 Q130.948,104.735,130.948,107.09 L130.948,116.752 Q130.948,119.107,128.593,119.107 L128.593,119.107 Q126.238,119.107,126.238,116.752 L126.238,107.09 Q126.238,104.735,128.593,104.735 Z"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M169.218,6.47664 L169.218,6.47664 Q166.863,6.47664,166.863,4.12162 L166.863,5.54001 Q166.863,7.89503,169.218,7.89503 L169.218,7.89503 Q171.573,7.89503,171.573,5.54001 L171.573,4.12162 Q171.573,6.47664,169.218,6.47664 Z"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round" />
    <path
        android:fillAlpha="0.48387098"
        android:fillColor="#2cb71a"
        android:pathData="M173.866, 7.92172 L 173.866, 7.92172 Q 171.511, 7.92172, 171.511, 5.5667 L 171.511,4.09493 Q 171.511,6.44995, 173.866,6.44995 L 173.866,6.44995 Q 176.221,6.44995, 176.221,4.09493 L 176.221, 5.5667 Q 176.221, 7.92172, 173.866, 7.92172 Z"
        android:strokeWidth="2.41540718"
        android:strokeAlpha="0.48387098"
        android:strokeLineJoin="round" />
    <path
        android:fillAlpha="0.98999999"
        android:fillColor="#2cb71a"
        android:pathData="M107.292,124.489 L 107.292,124.489 Q 104.937,124.489, 104.937,126.844 L 104.937,136.505 Q 104.937,138.86, 107.292,138.86 L 107.292,138.86 Q 109.647,138.86, 109.647,136.505 L 109.647,126.844 Q 109.647,124.489, 107.292,124.489 Z"
        android:strokeWidth="2.41540718"
        android:strokeAlpha="0.98999999"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M70.6076,172.683 L 71.0429,172.683 Q 68.4702,172.683, 68.4702,175.256 L 68.4702,185.811 Q 68.4702,188.383, 71.0429,188.383 L 70.6076,188.383 Q 73.1803,188.383, 73.1803,185.811 L 73.1803,175.256 Q 73.1803,172.683, 70.6076,172.683 Z"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M19.419, 211.623 L18.9836, 211.623 Q21.5563, 211.623,21.5563, 209.051 L21.5563, 198.496 Q21.5563, 195.923,18.9836, 195.923 L19.419, 195.923 Q16.8462, 195.923,16.8462, 198.496 L16.8462, 209.051 Q16.8462, 211.623,19.419, 211.623 Z"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M83.4017,169.639 L 83.8371,169.639 Q 81.2644,169.639, 81.2644,172.212 L 81.2644,182.766 Q 81.2644,185.339, 83.8371,185.339 L 83.4017,185.339 Q 85.9744,185.339, 85.9744,182.766 L 85.9744,172.212 Q 85.9744,169.639, 83.4017,169.639 Z"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M133.339, 163.758 L 133.774, 163.758 Q 131.202, 163.758, 131.202, 161.186 L 131.202, 150.631 Q 131.202, 148.058, 133.774, 148.058 L 133.339, 148.058 Q 135.912, 148.058, 135.912, 150.631 L 135.912, 161.186 Q 135.912, 163.758, 133.339, 163.758 Z"
        android:strokeWidth="2.52457666"
        android:strokeLineJoin="round" />
    <path
        android:fillType="evenOdd"
        android:pathData="M71.2256,158.659 C 68.039,153.392, 64.1607,154.191, 64.0522,154.218"
        android:strokeWidth="0.12077035"
        android:strokeColor="#000000" />
    <path
        android:fillType="evenOdd"
        android:pathData="M68.8345,158.232 C 67.756,156.715, 66.4003,155.521, 63.9668,155.585"
        android:strokeWidth="0.12077035"
        android:strokeColor="#000000" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M179.123,159.942 C 181.165,159.946, 183.173,160.725, 184.698,162.189 L 184.578,162.189 C 184.411,162.189, 184.276,162.324, 184.276,162.491 L 184.276,186.524 C 184.276,186.598, 184.304,186.665, 184.347,186.717 C 182.371,186.293, 180.55,185.131, 179.329,183.313 L 172.19,172.687 C 169.69,168.966, 170.673,163.958, 174.394,161.458 L 174.595,161.323 C 175.99,160.386, 177.567,159.938, 179.124,159.941 Z M 187.12,186.827 C 186.402,186.924, 185.678,186.922, 184.968,186.827 Z"
        android:strokeWidth="2.42433643"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#2cb71a"
        android:pathData="M168.567,153.011 C 165.699,153.011, 163.374,155.336, 163.374,158.204 C 163.374,161.072, 165.699,163.397, 168.567,163.397 C 171.435,163.397, 173.76,161.072, 173.76,158.204 C 173.76,155.336, 171.435,153.011, 168.567,153.011 Z"
        android:strokeWidth="2.41540718"
        android:strokeLineJoin="round" />
    <path
        android:fillColor="#ff0000"
        android:pathData="M228.855,129 L 227.806,129 L 227.806,130.313 L 228.855,130.313 Z M 228.855,122.597 L 227.806,122.597 L 227.806,125.982 L 227.909,127.827 L 228.746,127.827 L 228.855,125.982 Z"
        android:strokeWidth="0.26458332"
        android:strokeColor="#ffcc00" />
    <path
        android:fillColor="#ff0000"
        android:pathData="M228.855,129 L227.806,129 L 227.806,130.313 L 228.855,130.313 Z M 228.855,122.597 L 227.806,122.597 L 227.806,125.982 L 227.909,127.827 L 228.746,127.827 L 228.855,125.982 Z"
        android:strokeWidth="0.26458332"
        android:strokeColor="#ffcc00" />
    <path
        android:fillColor="#ff0000"
        android:pathData="M228.855,129 L227.806,129 L227.806,130.313 L228.855,130.313 Z M228.855,122.597 L227.806,122.597 L227.806,125.982 L227.909,127.827 L228.746,127.827 L228.855,125.982 Z"
        android:strokeWidth="0.26458332"
        android:strokeColor="#ffcc00" />
</vector>

这是我现在能看到的: img