Maher Ismaail Maher Ismaail - 2 months ago 82
Android Question

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

when I try to use :
android.support.v4.widget.CircleImageView

<android.support.v4.widget.CircleImageView
android:id="@+id/picture"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_vertical"
android:src="@drawable/ic_bg" />


it makes my app crash

how to support new Material Design Widget CircleImageView

is there any example use this new widget

Logcat

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vogella.android.recyclerview/com.vogella.android.recyclerview.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v4.widget.CircleImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2309)
at android.app.ActivityThread.access$700(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1289)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5317)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.v4.widget.CircleImageView
at

Answer

I found a solution which use this widget alternative to android.support.v4.widget.CircleImageView

<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/meal_image_order"
android:layout_width="96dp"
android:layout_height="96dp"
android:src="@drawable/menu1"
app:border_width="2dp"
app:border_color="@color/white"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
Comments