Reputation: 2305
I want create one shape such as below image, but I want create this with XML codes (in drawable) and I do not want create this with 9.patch images!
How can I create this shape with xml code?
Upvotes: 1
Views: 100
Reputation: 6908
Here is a work- around
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" android:padding="10dp">
<solid android:color="#FFFFFF"/>
<corners
android:bottomRightRadius="0dp"
android:bottomLeftRadius="0dp"
android:topLeftRadius="15dp"
android:topRightRadius="15dp"/>
</shape>
Tweak the corner radius to get your upper part curved!
or overlap this oval shape to get the desired output
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!--circle filling color-->
<solid android:color="#ffffff" />
<stroke
<!--radious can define in here-->
android:width="1dp"
android:color="#ffffff" />
<corners
android:bottomLeftRadius="2dp"
android:bottomRightRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp" />
</shape>
But basically, this is not the correct way to do this! Use another way around, use 9 patch
Upvotes: 1