Android image rounded corner effect,

Source: Internet
Author: User

Android image rounded corner effect,

Generally, you can use Java to add rounded corners to images, but you can also use pure XML + Nice-Patch images for faster processing. this method is recommended if the background is solid.

The principle is to use frameLayout to add a hidden image to the image to achieve the rounded corner effect.

Background image:

It is transparent in the middle. You can use ps to draw a rectangle with rounded corners, and then select and fill the corner color.

 

Layout file: 01

02 <framelayout <p = ""> </framelayout <>

03 android: layout_width = "48dp"

04 android: layout_height = "48dp"

05>

06 <imageview <p = "">

07 android: id = "@ + id/profile_image"

08; android: layout_width = "fill_parent"

09 android: layout_height = "fill_parent"

10/>

11

12 <imageview <p = "">

13 android: background = "@ drawable/images_border_radius"

14; android: layout_width = "fill_parent"

15 android: layout_height = "fill_parent"

16/>

17

The first ImageView is the target image, and the first ImageView is the shadow layer.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.