I want to draw xml layout shape above showing image android.please help me
Asked
Active
Viewed 1,712 times
-10

Sandeep Kumar
- 350
- 4
- 18
-
Try to post what you have done so far and what problem you are facing. – gprathour Dec 06 '16 at 07:28
-
http://stackoverflow.com/questions/2459916/how-to-make-an-imageview-with-rounded-corners check it – Nandkishor mewara Dec 06 '16 at 07:32
4 Answers
2
Try this:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="#ffffff" />
<stroke android:color="#80000000"
android:width="0.5dp"
/>
<corners
android:bottomLeftRadius="32dp"
android:topLeftRadius="32dp" />
</shape>

Sanif SS
- 602
- 5
- 18
2
First of all try to show your progress or what you have tried so far and where you have got stuck.
Secondly for your question, use below code :
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="10dp"
android:top="10dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/black" /> //change your desired color
//use can set your desired size to make curve
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="10dp"
android:topRightRadius="0dp" />
</shape>
</item>
Create this drawable and use in your xml

Anurag
- 1,162
- 6
- 20
1
If you want only left two corners to be curved. Then just set bottomRightRadius
& topRightRadius
to 0dp
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/color_Transport_Grey" />
<corners
android:bottomLeftRadius="10dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="10dp"
android:topRightRadius="0dp" />
<padding
android:left="0dip"
android:right="0dip" />
</shape>

MashukKhan
- 1,946
- 1
- 27
- 46
0
Your shape (fab.xml):
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="@color/main_light_extreme">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@color/main_light_extreme" />
</shape>
</item>
<item>
<shape android:shape="oval">
<solid android:color="@color/main_normal" />
</shape>
</item>
</ripple>
Your image with shape background (ImageButton):
<ImageButton
android:id="@+id/fab"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginBottom="54dp"
android:layout_marginEnd="36dp"
android:background="@drawable/fab"
android:src="@android:drawable/ic_menu_camera" <!-- your need this -->
android:elevation="12dp" />
Result (Note: ripple works only android api >= 21 Lollipop):
Image above drawable shape :D

Lucas
- 431
- 3
- 7