android - Strange Black Background after setMeasuredDimension in Custom ImageView -
i have library allows circularimageview have problem can't fix.
i add in layout way:
<linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <com.mikhaellopez.circularimageview.circularimageview android:id="@+id/circularimageview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/test" app:civ_border="true" app:civ_border_color="#3f51b5" app:civ_border_width="8dp" app:civ_shadow="true" app:civ_shadow_color="#3f51b5" app:civ_shadow_radius="10" /> </linearlayout> <linearlayout android:layout_width="240dp" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical"> <seekbar- android:layout_width="match_parent" android:layout_height="wrap_content" /> <!-- ... --> </linearlayout>
on picture have black background appears in view (on png images ic_launcher
for example works well):
i can fix problem when change onmesure
method.
before:
@override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { int width = measurewidth(widthmeasurespec); int height = measureheight(heightmeasurespec); int imagesize = (width < height) ? width : height; setmeasureddimension(imagesize, imagesize); }
after:
@override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { int width = measurewidth(widthmeasurespec); int height = measureheight(heightmeasurespec); /*int imagesize = (width < height) ? width : height; setmeasureddimension(imagesize, imagesize);*/ setmeasureddimension(width, height); }
but modification view isn't centered:
could me fix black background or find new way center view?
Comments
Post a Comment