Issue
I wish to use a button of this shape,pointing to right or left in my app.
Two corners of the button are rounded, and the other side is triangular.
I was able to accomplish this somewhat using a png image as background, but I would prefer to know how to do it in xml.
Solution
Not sure about the exact way to do that, but you could always increase the radius
of the topLeft
and bottomLeft
or Right to maximum, to get a semicircular pointing end.
This is how I tried to do it
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:topLeftRadius="100dp"
android:topRightRadius="31dp"
android:bottomLeftRadius="100dp"
android:bottomRightRadius="31dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#7995A8"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<size
android:width="172dp"
android:height="60dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
Answered By - Curator
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.