CircularImageView: Bug: cannot avoid center-crop

suppose I have a small image to show inside the circularImageView, how do I avoid it being center-cropped? I’ve set this:

            <com.mikhaellopez.circularimageview.CircularImageView
                android:id="@+id/movingIconImageView"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:layout_gravity="center_horizontal"
                android:src="@drawable/test"
                app:border="true" 
                app:border_color="#fff"
                app:border_width="0px"
                app:shadow="true"
                app:shadow_color="#000"
                app:shadow_radius="8"/>

and the image is of size 58x60 dp (it’s in the mdpi folder and has the same pixels size as the dp).

Yet this is what I see (ignore what’s behind ) :

untitled20151216104018

Same thing occurs when I have a 100x100 dp of the view. It always does center-crop…

I’ve tried changing the scaleType, but it doesn’t do anything. I’ve even tried forcing padding, but it didn’t help.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (6 by maintainers)

Most upvoted comments

How did you do it so fast?

Here’s a pretty elegant way

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <inset android:inset="8dp" android:drawable="@drawable/ic_check_white"/>
    </item>
    <item>
        <inset android:inset="8dp" android:drawable="@drawable/lock_v2"/>
    </item>
</selector>

where 8dp is the padding