android - Using a Layout to Make Rounded Corners affect on image -
i have imageview's
, seems trouble round corners using imageloader
or similar technique.
can make linearlayout
cover image? (or set image background?) example, if layout had rounded corners, hide portion of image beneath create rounded corner affect?
i have been trying play (specifically using image background) , can't seem hide image's corners.
well, framelayout or relativelayout can stack second layer on top of imageview like:
<framelayout android:layout_width="60dp" android:layout_width="60dp"> <imageview android:id="@+id/myimage" android:layout_width="60dp" android:layout_height="60dp" android:src="@drawable/myrealimage" /> <imageview android:id="@+id/my_roundedcorner_overlay" android:layout_width="60dp" android:layout_height="60dp" android:src="@drawable/myoverlaywithroundedcornersandtransparentcenter" /> </framelayout>
however, warned causes overdraw , makes layout more complex.
you set real image background imageview , overlay imageviews src, don't set padding in case (also loading images web library won't work anymore)
cleanest solution create custom widget extending imageview , override ondraw method, paint canvas using bitmapshader, similar http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/ pretty same, once , reuse want.
Comments
Post a Comment