Thoughts on Android (19): Button buttons and their subclasses

Source: Internet
Author: User
Tags event listener

Button , inherited from TextView, is a button that can be clicked, and clicking Triggers an onClick event, followed by a specific event listener.

The radio button RadioButton and check box checkboxes are inherited from the button, and areused as the name says.

RadioButton needs to be used with radiogroup to define a set of radio button.

Status Switch button ToggleButton and switch switches are also inherited from button, they all provide two states, Typically used to toggle a state in a program.

XML attributes and related methods supported by ToggleButton

XML Properties

Related methods

Description

Android:checked

Setchecked (Boolean)

Sets whether the button is selected

Android:textoff

Set the text to display when the state is closed

Android:texton

Set the text that is displayed when the status is turned on

XML attributes and related methods supported by Switch

XML Properties

Related methods

Description

Android:switchminwidth

Setswitchminwidth (int)

Set the minimum width of the switch

Android:switchpadding

setswitchpadding (int)

Set the gap between the switch and the caption text

Android:switchtextappearance

Setswitchtextappearance (Context,int)

Set the text style on the switch icon

Android:textoff

Settextoff (charsequence)

Set the text to display when the state is closed

Android:texton

Settexton (charsequence)

Set the text that is displayed when the status is turned on

Android:textstyle

Setswitchtypeface (Typeface)

Set the text style of the switch

Android:thumb

Setthumbresource (int)

Draw a switch button using a custom drawable

Android:thumbtextpadding

setthumbtextpadding (int)

Set the white space between the button and the caption text

Android:track

Settrackresource (int)

draw a switch track using a custom drawable

Android:typeface

Setswitchtypeface (Typeface)

Set the font style of the switch text

Thoughts on Android (19): Button buttons and their subclasses

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.