Android Layout Custom Shap circular ImageView can set backgrounds and pictures individually _android

Source: Internet
Author: User
Tags set background

First, picture preview:

First, realize the function:

Requirements to implement a circular picture in the layout, the picture background is separated from the icon and merged into a imageview.

Second, the concrete realization:

XML layout in the definition of ImageView, the key to set two parameters Android:backgroup (set background), ANDROID:SRC (set ImageView in the picture), the circle picture production drawable under the definition of XML Shap style ( Solid-color,size-width\hight)

The XML code is as follows:

<imageview
android:id= "@+id/zhongjie"
android:layout_width= "wrap_content"
android:layout_height = "Wrap_content"
android:background= "@drawable/popwindow_zhongjie"
android:scaletype= "Centerinside"

drawable-style XML is as follows:

<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"Http://schemas.android.com/apk/res" /android "
android:shape=" Oval "
android:uselevel=" false ">
<solid android:color=" #66CC00 "/>
<size android:width= "50DP"
android:height= "50DP"/>
</shape>

Through the above content to introduce the Android layout of the custom Shap circular ImageView can be set up a separate background and pictures of the relevant knowledge, I hope that the future work of everyone to help.

Related Article

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.