I want to make rounded corners for below mentioned layout:
I've created this drawable by using layer-list
tags as:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:width="250dp"
android:height="250dp">
<shape android:shape="rectangle">
<stroke
android:width="15px"
android:color="@android:color/transparent" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item
android:width="@dimen/margin_8"
android:bottom="0dp"
android:top="200dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="@dimen/margin_8"
android:bottom="200dp"
android:top="0dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="@dimen/margin_8"
android:bottom="0dp"
android:gravity="right"
android:top="200dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="@dimen/margin_8"
android:bottom="200dp"
android:gravity="right"
android:top="0dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="@dimen/margin_8"
android:gravity="top"
android:left="0dp"
android:right="200dp"
android:top="-1dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="@dimen/margin_8"
android:gravity="top"
android:left="200dp"
android:right="0dp"
android:top="-1dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="@dimen/margin_8"
android:gravity="bottom"
android:left="0dp"
android:right="200dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="@dimen/margin_8"
android:gravity="bottom"
android:left="200dp"
android:right="0dp">
<shape android:shape="rectangle">
<solid android:color="#6fdc8c" />
</shape>
</item>
</layer-list>
I need it like below image.
I have tried to add the corners
tag inside shape
but it didn't work. Hope my query is clear. Thanks in advance.
CodePudding user response:
try this code
<item
android:width="8dp"
android:bottom="0dp"
android:gravity="right"
android:top="200dp">
<shape android:shape="rectangle">
<corners android:bottomRightRadius="10dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="8dp"
android:gravity="bottom"
android:left="200dp"
android:right="0dp">
<shape android:shape="rectangle">
<corners android:bottomRightRadius="10dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
CodePudding user response:
Here is the full code for your view
<stroke
android:width="25px"
android:color="@android:color/transparent" />
<solid android:color="@android:color/transparent" />
<corners android:radius="10dp" />
</shape>
</item>
<item
android:width="7dp"
android:bottom="0dp"
android:start="0dp"
android:top="200dp">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="7dp"
android:bottom="200dp"
android:top="0dp">
<shape android:shape="rectangle">
<corners android:topLeftRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="7dp"
android:bottom="0dp"
android:gravity="right"
android:top="200dp">
<shape android:shape="rectangle">
<corners android:bottomRightRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:width="7dp"
android:bottom="200dp"
android:gravity="right"
android:top="0dp">
<shape android:shape="rectangle">
<corners android:topRightRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="7dp"
android:gravity="top"
android:left="0dp"
android:right="200dp"
android:top="-1dp">
<shape android:shape="rectangle">
<corners android:topLeftRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="7dp"
android:gravity="top"
android:left="200dp"
android:right="0dp"
android:top="-1dp">
<shape android:shape="rectangle">
<corners android:topRightRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="7dp"
android:bottom="0dp"
android:gravity="bottom"
android:left="0dp"
android:right="200dp">
<shape android:shape="rectangle">
<corners android:bottomLeftRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
<item
android:height="7dp"
android:gravity="bottom"
android:left="200dp"
android:right="0dp">
<shape android:shape="rectangle">
<corners android:bottomRightRadius="20dp" />
<solid android:color="#6fdc8c" />
</shape>
</item>
OUTPUT