Image View background reflect only inside the circle not outside the circle. I tried so many things but not able do that. Anybody please me. Thanks!!
Make an .xml
file in drawable folder with this content:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="@color/black"/>
</shape>
Then set this file as your background.
circle.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
<size android:width="50dp"
android:height="50dp"/>
<stroke
android:width="3dp"
android:color="@color/black"/>
<solid android:color="@color/black"/>
</shape>
in ImageView add this in
android:background="@drawable/circle"
thank you everyone for the help. This code is working as I want. thank You!!
I guess you're using CircularImageView custom imageview class to make it circular. That's why background it getting apllied in cicular region only.
To solve it, do something like this,
<LineaLayout
android:width="wrap_content"
android:height="wrap_content"
android:orientation="vertical"
android:background="@color/black"/>
<!-- your circular CircularImageView here..!! -->
</LinearLayout>
Other solution you can do is, Use native ImageView
and set its android:src
by creating circular bitmap
and use android:background
black color and i would suggest to go with thise solution as you can avoid nested layouts.
I hope this hepls! Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With