Actually I wanna convert the image into the mentioned shape in picture . I've tried a lot of similar questions in SO
but none of them were helpful. You may advise to use drawable in foreground of imageView
but I've gotta set the foreground programmatically which is valid only api>23 . Can anyone please help me to solve this issue?
You can see in image that there's background of image . I wanna convert the image into that shape programmatically.
Even I tried to use Gradient Drawable
but it was futile
Code:
GradientDrawable gradientDrawable= new GradientDrawable();
float[] radii = new float[8];
radii[0] = 15; // Goes clockwise, so this is the top left corner start position.
radii[1] = 15; // top left end position.
radii[2] = 15;
radii[3] = 15;
radii[4]=0;
radii[5]=0;
radii[6] = 15;
radii[7] = 15;
gradientDrawable.setCornerRadii(radii);
holder.img.setBackgroundDrawable(gradientDrawable);