如何在android中创建圆曲线矩形?
答
在可绘制文件夹中创建一个xml文件,并将此可绘制文件设置为您视图的背景。它会帮助你...
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ff25183d" />
<!-- <stroke android:width="1dp"
android:color="#ff666666"
/>-->
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
</shape>
+0
我不仅需要从各方围绕角落。仔细阅读问题并提出答案。 – Noorul
答
在绘制对象文件夹中创建文件
文件名:round_corner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#000000"/>
<corners
android:bottomRightRadius="5dp"
android:bottomLeftRadius="5dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp"/>
</shape>
而在这样的XML文件应用背景:
android:background="@drawable/round_corner"
+0
为什么这些人在回答之前没有听到这个问题..我不仅需要圆角围脖。甚至还会并排弯曲。仔细看图像。并回答。 – Noorul
答
这对我来说只是检查它。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="105dp" />
<gradient
android:angle="270"
/>
<stroke
android:width="1dp"
android:color="#000" />
<padding
android:left="15dp"
android:top="15dp"
android:right="15dp"
android:bottom="15dp" />
</shape>
OP希望圆角+弧形边缘 –
@pgiitu仔细看答案的问题,或者告诉我有可能dublicate..lol – Noorul
是科坦阿尔。答案热烈欢迎。 – Noorul