【发布时间】:2019-02-28 00:45:43
【问题描述】:
我正在尝试创建一个自定义形状以用作我的菜单抽屉的背景。我遇到的问题是我无法得到我想要的形状。目前,我在 Adobe Illustrator 中将形状创建为 svg,然后将 converting 转换为 XML 可绘制对象,但它没有达到预期的效果。如何根据其父级 (match_parent) 和内容 (wrap_content) 来缩放可绘制的矢量?
menu_shape.xml
我发现的一个问题是,这种形状的响应并不准确,因为它本质上是被挤压以适应视口,因此根据屏幕尺寸的不同表现得非常不同。
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="597.28"
android:viewportHeight="542.16"
android:width="597.28dp"
android:height="542.16dp">
<path
android:pathData="M0.5 303.39V0.5H596.78V370.39S310.5 797.13 0.5 303.39Z"
android:fillColor="#A92324"
android:strokeColor="#231F20"
android:strokeWidth="1"
android:strokeMiterLimit="10" />
</vector>
当前结果:
期望的结果:
想要的结果本质上是一个稍微向右偏移的大圆圈
【问题讨论】:
-
@Sha-1 你有 SVG 的形状吗?
标签: android android-drawable android-shape