Android Chinese API (33) -- Checkable

Source: Internet
Author: User

Preface

This chapter is about android. widget. Checkable, translated from "CN 7". Thanks again "CN 7 "! Welcome to join in Android API Chinese translation, contact me over140@gmail.com.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog Garden: http://www.cnblogs.com/

Android Chinese translation group: http://www.cnblogs.com/over140/

 

Body

I. Structure

    Public interface Checkable

 

Indirect subclass

CheckBox, CheckedTextView, CompoundButton, RadioButton, ToggleButton

 

Ii. Overview

    

This interface defines an extension so that the view control inherited from it has optional state attributes.

(Note: any class that inherits this interface has the android: checked attribute .)

    

 

Iii. Public Methods

Public abstract boolean isChecked ()

Query the selected status of the current view control.

Return Value:

Returns a boolean value to indicate the selected status of the current view control. If the current control is selected, the return value is true. Otherwise, the return value is false.

(Note: it is not necessarily that the control displays a right sign or a point that is selected, it is very likely that a programmer with a different thinking will define a right number as unselected and return a false value. Of course, this is only possible. In general sense, the right sign and point indicate true, and vice versa .)

 

Public abstract void setChecked (boolean checked)

Sets the selected status of the current view control. Note:

Before Execution

Run

After execution

Any status

SetChecked (true)

Selected

Any status

SetChecked (false)

Not selected

Parameters:

Checked specifies that the control is selected in the "true" status, indicating that the control is set to selected, and "false" indicates that the control is not selected.

 

Public abstract void toggle ()

This method is used to switch the selected status of the current view control. (Note: Changes the current status of the View control to the opposite status .)

Before Execution

Run

After execution

Selected

Toggle ()

Not selected

Not selected

Toggle ()

Selected

 

 

End

The author of this article is very careful and even somewhat touched. Let's take a look at the original article and then look at this article. The translator has added many notes that are easier to understand, thanks again to "CN 7" for providing excellent works!

 

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.