I have an imageView and and I'm trying to create rounded corners, tried all of the solutions from this post: How to make an ImageView with rounded corners? But nothing worked.. Here's my XML
<RelativeLayout
android:id="@+id/RL_ImageHolder"
android:layout_width="150dp"
android:layout_height="180dp"
android:layout_alignBottom="@+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/relativeLayout2"
android:layout_marginLeft="10dp" >
<ImageView
android:id="@+id/imgPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:contentDescription="Preview"
/>
</RelativeLayout>
and that's how I set the ImageView using the method mentioned in the post I've linked above:
byteArray = extras.getByteArray("picture");
if (byteArray != null) {
bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
preview.setScaleType(ScaleType.CENTER_CROP);
preview.setImageBitmap(getRoundedCornerBitmap(bmp));
The image is set correctly, but it keeps a rectangle.. Any ideas why it doesn't work?
EDIT: just found out that is doesn't work only when the layout holding the image has a fixed width/height.. Gotta think how to manage that. Thanks guys