如何在android中创建圆曲线矩形?

问题描述:

我需要创建这种设计。帮助我。如何在android中创建圆曲线矩形?

enter image description here

帮助将不胜感激。

+0

OP希望圆角+弧形边缘 –

+0

@pgiitu仔细看答案的问题,或者告诉我有可能dublicate..lol – Noorul

+0

是科坦阿尔。答案热烈欢迎。 – Noorul

在可绘制文件夹中创建一个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> 
+0

没有不工作 – Noorul

+0

您可以根据您的要求调整梯度角度和半径。 –

+0

梯度是颜色花花公子。它如何改变形状? – Noorul