我创建了一个形状可绘制资源xml文件,用于创建具有两个侧弯角的背景。
这里我发布了Shape drawable的代码。但它没有给我正确的结果。它给我4侧弯曲图像。
所以我只是想知道如何创建2个侧面弯曲形状的图像。
谢谢
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#0579CD" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
<padding
android:bottom="8dp"
android:left="8dp"
android:right="8dp"
android:top="8dp" />
答案 0 :(得分:5)
只需将矿工值传递给非曲线角落区域即可。 在你的情况下:
<corners
android:bottomLeftRadius="0.1dp"
android:bottomRightRadius="0.1dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />
还有一件事。预览不会以图形布局显示。您应该尝试在设备中查看。
我希望这能帮到您。
答案 1 :(得分:2)
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"
/>
你给出了所有的半径,所以它给你正确的结果。你必须只提供两个选项:
<corners
android:topLeftRadius="15dp"
android:topRightRadius="15dp"
/>
或任何其他可能的情况。