gpt4 book ai didi

android - 图层列表被裁剪为可绘制

转载 作者:行者123 更新时间:2023-11-29 18:29:34 25 4
gpt4 key购买 nike

这是我正在尝试构建的所需可绘制对象。

Desired result

问题:

据我所知,图层列表的大小取决于其中的最后一项。但是如果我使用 android:drawable内部标签 <item> , 层列表被裁剪到可绘制大小并不重要它在什么位置。

这是我的 swipe_close.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="34dp"
android:useLevel="false">
<solid android:color="#ffffff" />
</shape>
</item>
<item android:drawable="@drawable/ic_close_swipe" />
<item>
<shape
android:innerRadius="34dp"
android:shape="ring"
android:thickness="10dp"
android:useLevel="false">
<solid android:color="#E6E6E6" />
</shape>
</item>
</layer-list>

还有 ic_close_swipe.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="39dp"
android:height="39dp"
android:viewportWidth="39"
android:viewportHeight="39">
<path
android:pathData="M37.7269,5.2568C38.5079,4.4757 38.5079,3.2094 37.7269,2.4283L36.5711,1.2726C35.7901,0.4916 34.5238,0.4916 33.7427,1.2726L20.7758,14.2395C19.9947,15.0206 18.7284,15.0206 17.9473,14.2395L4.9804,1.2726C4.1994,0.4916 2.933,0.4916 2.152,1.2726L0.9962,2.4283C0.2152,3.2094 0.2152,4.4757 0.9962,5.2568L13.9632,18.2237C14.7442,19.0048 14.7442,20.2711 13.9632,21.0521L0.9962,34.0191C0.2152,34.8001 0.2152,36.0665 0.9962,36.8475L2.152,38.0032C2.933,38.7843 4.1994,38.7843 4.9804,38.0032L17.9473,25.0363C18.7284,24.2553 19.9947,24.2553 20.7758,25.0363L33.7427,38.0032C34.5238,38.7843 35.7901,38.7843 36.5711,38.0032L37.7269,36.8475C38.5079,36.0665 38.5079,34.8001 37.7269,34.0191L24.7599,21.0521C23.9789,20.2711 23.9789,19.0048 24.7599,18.2237L37.7269,5.2568Z"
android:fillColor="#C4C4C4"/>
</vector>

最佳答案

我建议按如下方式更改 swipe_close.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="34dp"
android:useLevel="false">
<solid android:color="#ffffff" />
</shape>
</item>
<item
android:bottom="25dp"
android:drawable="@drawable/ic_close_swipe"
android:left="25dp"
android:right="25dp"
android:top="25dp" />
<item>
<shape
android:shape="ring"
android:thickness="10dp"
android:useLevel="false">
<solid android:color="#E6E6E6" />
</shape>
</item>
</layer-list>

希望对您有所帮助!

关于android - 图层列表被裁剪为可绘制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56973438/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com