Radiobutton also serves as a tab.

Source: Internet
Author: User

Android advanced UI deep customization series (2)

Radiobutton also serves as a tab.

:

XML layout:

 <  Radiogroup  Android: ID  = "@ + ID/radiogroup1"  Android: layout_width  = "Match_parent" Android: layout_height  = "Wrap_content"  Android: Orientation  = "Horizontal"   >          <  Radiobutton  Android: ID  = "@ + ID/radio0"  Android: layout_width  = "Match_parent"  Android: layout_height  = "Wrap_content"  Android: layout_weight = "1"  Android: Background  = "@ Drawable/XXX"  Android: button  = "@ Drawable/NONE"  Android: checked  = "True"  Android: drawabletop  = "@ Drawable/yyy"  Android: Text  = "Radiobutton"   />          <  Radiobutton Android: ID  = "@ + ID/radio1"  Android: layout_width  = "Match_parent"  Android: layout_height  = "Wrap_content"  Android: layout_weight  = "1"  Android: Background  = "@ Drawable/XXX"  Android: button  = "@ Drawable/NONE"  Android: drawabletop = "@ Drawable/yyy"  Android: Text  = "Radiobutton"   />           <  Radiobutton  Android: ID  = "@ + ID/Radio2"  Android: layout_width  = "Match_parent"  Android: layout_height  = "Wrap_content"  Android: layout_weight  = "1" Android: Background  = "@ Drawable/XXX"  Android: button  = "@ Drawable/NONE"  Android: drawabletop  = "@ Drawable/yyy"  Android: Text  = "Radiobutton"   />      </  Radiogroup  > 

 

Important attributes:

 
Android: drawabletop, Android: button, Android: Background

as the ADT continues to upgrade, visual UI editing becomes more convenient and efficient. Through the properties panel, you can quickly query and set various attributes of the UI component.
radiobutton is a prerequisite for personalized customization. Android: drawabletop indicates the image resources in the upper part of the component, which is not available by default. Android: the button indicates the circle radio we usually see, which is a drawable resource instead of a button ID. Android: Background certainly indicates the background image of the entire radiobtton.
in order for the three radiobutton to evenly occupy the screen width, set layout_width to match_parent and set their layout_weight to the same priority when assigning the width.
advantages:
the selected status is maintained to achieve different visual effects. The common practice is to change the effect only when you click or touch the screen. In this example, the effect is solidified, the checked attribute of radiobutton is used

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.