How I add corner radius for imageview, if add shape with xml my shape in bacground and image is full no have corner
There are lots of ways to do this. You mentioned that you were using XML, so here is one trick/hack along that lines. It's not the most elegant, but it's pretty simple. It involves using two ImageViews in a FrameLayout, one ImageView holds what you want to display, the other holds a "frame" with rounded corners:
Create a file called rounded_frame.xml and place it in your drawables folder:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#00ffffff" />
<corners android:radius="12dp" />
<stroke android:width="6dp" android:color="#ffffffff" />
Next add a FrameLayout, which will contain two images views, one with your picture and another with a frame to rounde the corners.
This isn't the only way to achieve this effect, but it's a pretty easy way. I'll see if I can whip up a sample project later today for you.
@TomOpgenorth ty, can I android:color="#ffffffff" in stroke set gradient and how ? My question and code https://forums.xamarin.com/discussion/40386/how-add-gradient-to-stroke#latest
@TomOpgenorth - when trying your sample get an error:
No resource found that matches the given name (at 'src' with value '@drawable/rounded_frame')
The rounded_frame.xml file is hosted inside the drawable folder and if I type in my code Resource.Drawable.rounded_frame the Intellisense recognize and completes it.
Any thoughts what I'm missing here?
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies