Why i am not able to create the round border for specific corner?
I am also facing the same problem. But for that I use layer-list. I post my answer here which may help you.
Please check output screen
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#c1c1c1" /> <solid android:color="#c1c1c1" /> <corners android:radius="20dp"/> </shape> </item> <item android:right="20dp" > <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#c1c1c1" /> <solid android:color="#c1c1c1" /> </shape> </item></layer-list>
You'll have to do that, assuming you only want a rounded top left corner:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <corners android:radius="20sp" android:topRightRadius="0dp" android:bottomRightRadius="0dp" android:bottomLeftRadius="0dp" /> <gradient android:startColor="@color/logo_blue" android:endColor="@color/blue" android:angle="0"/></shape>
Explanation: Every corner must (initially) be provided a corner radius greater than 1, or else no corners are rounded. If you want specific corners to not be rounded, a work-around is to use android:radius
to set a default corner radius greater than 1, but then override each and every corner with the values you really want, providing zero ("0dp") where you don't want rounded corners. [source]
As a consequence, you need to define your drawable as:
<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="1dip" android:color="#ffffff"/> <solid android:color="#95865F"/> <corners android:radius="10px" android:topRightRadius="0dp" android:bottomRightRadius="0dp" /> <padding android:left="1dp" android:right="1dp" android:top="1dp" android:bottom="1dp"/> </shape>
Update
From The Shape Drawable Resource Android Documentation:
android:radius Dimension. The radius for all corners, as a dimension value or dimension resource. This is overridden for each corner by the following attributes.
overridden is the keyword for your problem…
I'm using SDK tools 19, platform-tools 11 and running the app in Android 4.0.3. Using the following XML works for me:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#dd000000"/> <padding android:left="7dp" android:top="7dp" android:right="7dp" android:bottom="7dp" /> <corners android:bottomLeftRadius="25dp" android:bottomRightRadius="25dp" android:topLeftRadius="0dp" android:topRightRadius="0dp" /></shape>
The Eclipse warning is about not being able to show the preview. In het app it shows up correct.