android - Round Corner image exception -
android - Round Corner image exception -
when want utilize round-corner image library github ( : this ) throws exception , utilize this project android developer site in it's xml file chang quickcontactbadge circularimage , in circular library class throws next exception :
pid: 23756 java.lang.classcastexception: android.graphics.drawable.transitiondrawable cannot cast android.graphics.drawable.bitmapdrawable @ ir.im.ui.helper.roundedimageview.ondraw(roundedimageview.java:65)
another things mention : when utilize imageview instead of library doesn't throws exception body knows what's reason ? , how can solve ?
here xml :
<ir.im.ui.helper.roundedimageview android:id="@android:id/icon" android:layout_height="?android:attr/listpreferreditemheight" android:layout_width="?android:attr/listpreferreditemheight" android:scaletype="centercrop" android:src="@drawable/ic_contact_picture_holo_light" />
and here google sample
<quickcontactbadge android:id="@android:id/icon" android:layout_height="?android:attr/listpreferreditemheight" android:layout_width="?android:attr/listpreferreditemheight" android:scaletype="centercrop" style="@style/quickcontactbadgestyle" android:src="@drawable/ic_contact_picture_holo_light"/>
and here function throws exception :
@override protected void ondraw(canvas canvas) { if (((bitmapdrawable) getdrawable()) != null) { mbitmap = ((bitmapdrawable) getdrawable()).getbitmap(); mbitmapshader = new bitmapshader(mbitmap, shader.tilemode.clamp, shader.tilemode.clamp); } paint.setantialias(true); paint.setshader(mbitmapshader); mroundrectshape.resize(getwidth(), getheight()); mroundrectshape.draw(canvas, paint); }
android xml quickcontactbadge
Comments
Post a Comment