Please how can I achieve the image below as background for an image view.
Asked
Active
Viewed 119 times
1 Answers
2
Create my_shape.xml
under res/drawable
:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#A5A5A5" />
<corners
android:bottomRightRadius="75dp"
android:topLeftRadius="100dp" />
</shape>
</item>
</layer-list>
Then, you can apply it to your view with:
android:background="@drawable/my_shape"

Zain
- 37,492
- 7
- 60
- 84
-
Yeah I did this but when the image appear the background is gone. – Darotudeen Nov 30 '20 at 21:06
-
Do you set it to an ImageView with background, and also have another image set to this ImageView .. can you elaborate more? – Zain Nov 30 '20 at 21:09
-
i suppose he wants the shape to be only pattern of the image am I right? – ATP Nov 30 '20 at 21:37
-
@user9977151 I guess that also, maybe they need it in the background while the image can have some opacity – Zain Nov 30 '20 at 21:41
-
duplicate of https://stackoverflow.com/questions/2459916/how-to-make-an-imageview-with-rounded-corners ? – ATP Nov 30 '20 at 21:45