Reputation: 12293
I set android:radius="20dp"
but why rounded corners only at the left? Red shape should also have rounded corners at the right as well
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#c61b1f" />
<corners
android:radius="20dp"/>
<padding android:left="60dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#eeeeee" />
</shape>
</item>
</layer-list>
Updated
I want to achieve the next background for EditText
We can set width
for item
(for first left shape) but it's only available from 23+ API, I need to support 21+
I have a solution for 23+ API:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
// white shape
<shape android:shape="rectangle">
<solid android:color="#eeeeee" />
<corners android:radius="20dp"/>
</shape>
</item>
// red shape
<item android:width="60dp">
<shape android:shape="rectangle">
<solid android:color="#c61b1f" />
<corners
android:radius="20dp"/>
</shape>
</item>
</layer-list>
Upvotes: 0
Views: 968
Reputation: 2318
You can try the following, the right side also has a corner radius now.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners
android:radius="20dp"/>
<solid android:color="#eeeeee" />
</shape>
</item>
<item android:right="340dp">
<shape android:shape="rectangle">
<solid android:color="#c61b1f" />
<corners
android:radius="20dp"/>
</shape>
</item>
</layer-list>
It gives the following result
Upvotes: 0
Reputation: 951
Invisible because of being covered.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#c61b1f" />
<corners android:radius="20dp" />
<padding android:left="60dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="#eeeeee" />
<corners
android:bottomRightRadius="20dp"
android:topRightRadius="20dp" />
</shape>
</item>
</layer-list>
Upvotes: 0