Android
android.widget
public abstract class

android.widget.CheckedTextView

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.widget.TextView ViewTreeObserver.OnPreDrawListener
android.widget.CheckedTextView Checkable

An extension to TextView that supports the Checkable interface. This is useful when used in a ListView where the it's setChoiceMode has been set to something other than CHOICE_MODE_NONE.

Summary

XML Attributes inherited from class android.widget.TextView
XML Attributes inherited from class android.view.View
Constants inherited from class android.view.View
Fields inherited from class android.view.View

Public Constructors

            CheckedTextView(Context context)
            CheckedTextView(Context context, AttributeSet attrs)
            CheckedTextView(Context context, AttributeSet attrs, int defStyle)

Public Methods

          boolean  isChecked()
          void  setCheckMarkDrawable(Drawable d)
Set the checkmark to a given Drawable.
          void  setCheckMarkDrawable(int resid)
Set the checkmark to a given Drawable, identified by its resourece id.
          void  setChecked(boolean checked)

Changes the checked state of this text view.

          void  setPadding(int left, int top, int right, int bottom)
Sets the padding.
          void  toggle()
Change the checked state of the view to the inverse of its current state

Protected Methods

          void  drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
          int[]  onCreateDrawableState(int extraSpace)
Generate the new Drawable state for this view.
          void  onDraw(Canvas canvas)
Implement this to do your drawing.
Methods inherited from class android.widget.TextView
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.ViewTreeObserver.OnPreDrawListener
Methods inherited from interface android.widget.Checkable

Details

Public Constructors

public CheckedTextView(Context context)

public CheckedTextView(Context context, AttributeSet attrs)

public CheckedTextView(Context context, AttributeSet attrs, int defStyle)

Public Methods

public boolean isChecked()

public void setCheckMarkDrawable(Drawable d)

Set the checkmark to a given Drawable. This will be drawn when isChecked() is true.

Parameters

d The Drawable to use for the checkmark.

public void setCheckMarkDrawable(int resid)

Set the checkmark to a given Drawable, identified by its resourece id. This will be drawn when isChecked() is true.

Parameters

resid The Drawable to use for the checkmark.

public void setChecked(boolean checked)

Changes the checked state of this text view.

Parameters

checked true to check the text, false to uncheck it

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

Sets the padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from getPaddingLeft(), getPaddingTop(), getPaddingRight() and getPaddingBottom() may be different from the values set in this call.

Parameters

left the left padding in pixels
top the top padding in pixels
right the right padding in pixels
bottom the bottom padding in pixels

public void toggle()

Change the checked state of the view to the inverse of its current state

Protected Methods

protected void drawableStateChanged()

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

Be sure to call through to the superclass when overriding this function.

protected int[] onCreateDrawableState(int extraSpace)

Generate the new Drawable state for this view. This is called by the view system when the cached Drawable state is determined to be invalid. To retrieve the current state, you should use getDrawableState().

Parameters

extraSpace if non-zero, this is the number of extra entries you would like in the returned array in which you can place your own states.

Returns

  • Returns an array holding the current Drawable state of the view.

protected void onDraw(Canvas canvas)

Implement this to do your drawing.

Parameters

canvas the canvas on which the background will be drawn
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48