繁体   English   中英

创建矩形形状drawable与android中的两个侧弯角

[英]Create rectangle shape drawable with two side curved corner in android

我创建了一个形状可绘制资源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" />

只需将矿工值传递给非曲线拐角区域即可。 在你的情况下:

<corners
android:bottomLeftRadius="0.1dp"
android:bottomRightRadius="0.1dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp" />

还有一件事。 预览不会以图形布局显示。 您应该尝试在设备中查看。
我希望这能帮到您。

<corners
    android:bottomLeftRadius="0dp"
    android:bottomRightRadius="0dp"
    android:topLeftRadius="15dp"
    android:topRightRadius="15dp" 
/>

你给了所有的半径,所以它给你正确的结果。 你必须只给出两个选项:

<corners
    android:topLeftRadius="15dp"
    android:topRightRadius="15dp" 

/>

或任何其他可能的情况。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM