android.support.v4.widget.CircleImageView does not work

The CircleImageView is a private class of the support library and cannot be used. But it is easy to create this effect yourself without the CircleImageView. You just need to define a <shape /> drawable with a transparent circle in the middle similar to this:

<shape
    android:innerRadius="0dp"
    android:shape="ring"
    android:thicknessRatio="1"
    android:useLevel="false" >

    <solid android:color="@android:color/transparent" />

    <stroke
        android:width="100dp"
        android:color="#FFFFFFFF" />
</shape>

After that just combine the image you want to display in the ImageView with the <shape /> drawable from above in a LayerList like this:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/your_image" />
    <item android:drawable="@drawable/circle" />
</layer-list>

If the image you want to display is dynamic then you can create the LayerList programmatically!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)