Reputation: 89
i am trying to make a background image with rounded corners for setting it in layout.The problem is how to set a image in drawable XML for rounded corners rather than using a solid color.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<!-- you can use any color you want I used here gray color-->
<solid android:color="#ffffff"/>
<corners
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:topLeftRadius="10dp"
android:topRightRadius="10dp"/>
</shape>
Upvotes: 2
Views: 5607
Reputation: 4169
This works for me: just add a file name round_corners.xml to drawable
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/lemon" android:endColor="@color/lemon_cream" android:angle="90" />
<corners android:radius="30dp" />
</shape>
add this XML
to the file and enjoy round corners.
Upvotes: 2