RoundedImageView icon indicating copy to clipboard operation
RoundedImageView copied to clipboard

Question/bug: why do I get a bad rounded rectangle using RoundedDrawable ?

Open AndroidDeveloperLB opened this issue 8 years ago • 1 comments

I use this :

        ImageView iv = (ImageView) findViewById(R.id.image);
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.photo1);
        final RoundedDrawable roundedDrawable = RoundedDrawable.fromBitmap(bitmap);
        roundedDrawable.setCornerRadius(0,100,100,0);
        iv.setImageDrawable(roundedDrawable);
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.makeramen.roundedimageview.example.MainActivity">


    <ImageView
        android:id="@+id/image"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_gravity="center"
        android:scaleType="centerCrop"/>
</FrameLayout>

And get this: 1

Even when I set wrap_content for both width and height, I get this (not quite rounded corners) :

2

How come?

AndroidDeveloperLB avatar Apr 09 '16 15:04 AndroidDeveloperLB

Cannot reproduce this bug. Everything is well here with your code. Using roundedimageview:2.2.1.

einverne avatar Sep 01 '16 09:09 einverne