Android Chinese API (28) -- CheckedTextView

Source: Internet
Author: User

Preface

This chapter is about android. widget. CheckedTextView. The version is Android 2.2 r1. The translation is from Xiaoyi. Thank you again! I look forward to your participation 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 class CheckedTextView extends TextView implements Checkable

 

Java. lang. Object

Android. view. View

Android. widget. TextView

Android. widget. CheckedTextView

 

Ii. Overview

    

The class CheckedTextView inherits TextView and implements the Checkable interface. This class is useful when the setChoiceMode method of ListView is set to CHOICE_MODE_SINGLE or CHOICE_MODE_MULTIPLE instead of CHOICE_MODE_NONE.

 

Iii. Public Methods

Public boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

Send an auxiliary event when building the sub-view. (Note: The Source Code shows that the selected status is set during View Construction .)

Parameters

Event

Return Value

Returns true if event processing is complete.

 

Public boolean isChecked ()

Select or not.

 

Public void setCheckMarkDrawable (Drawable d)

Sets the check mark for a given Drawable. Draw when isChecked () is true

Parameters

D. Check the Drawable of the tag.

 

Public void setCheckMarkDrawable (int resid)

Sets the check mark for a given Drawable and uses its resource id to identify it. Draw when isChecked () is true

Parameters

Resid is used to check the marked Drawable

 

Public void setChecked (boolean checked)

Change the selected status of the Text View

Parameters

If the checked text is selected, true is returned. If not selected, false is returned.

 

Public void setPadding (int left, int top, int right, int bottom)

Set the margins. The view may add some necessary space for displaying the scroll bar and depending on the type and visibility of the scroll bar. Therefore, the set value is used to call back getPaddingLeft (), getPaddingTop (), getPaddingRight (), and getPaddingBottom (). Different values are returned.

Parameters

Left margin (in pixels)

Top margin (in pixels)

Right margin (in pixels)

Bottom margin of bottom (in pixels)

 

Public void toggle ()

Returns the selected status of the current view.

 

 

Iv. Supplement

4.1 article link

Something about CheckedTextView

Android API CheckedTextView code demonstration

CheckedTextView display problems

 

4.2 Sample Code

For implementation code, see articles 1 and 2, or click here to download the code.

 

 

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.