|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.widget.TextView
android.widget.Button
android.widget.CompoundButton
android.widget.ToggleButton
public class ToggleButton
Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class android.widget.CompoundButton |
|---|
CompoundButton.OnCheckedChangeListener, CompoundButton.SavedState |
| Nested classes/interfaces inherited from class android.widget.TextView |
|---|
TextView.BufferType |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary |
|---|
| Constructor Summary | |
|---|---|
ToggleButton(Context context)
|
|
ToggleButton(Context context,
AttributeSet attrs)
|
|
ToggleButton(Context context,
AttributeSet attrs,
int defStyle)
|
|
| Method Summary | |
|---|---|
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. |
CharSequence |
getTextOff()
Returns the text for when the button is not in the checked state. |
CharSequence |
getTextOn()
Returns the text for when the button is in the checked state. |
protected void |
onFinishInflate()
Finalize inflating a view from XML. |
void |
setBackgroundDrawable(Drawable d)
Set the background to a given Drawable, or remove the background. |
void |
setChecked(boolean checked)
Changes the checked state of this button. |
void |
setTextOff(CharSequence textOff)
Sets the text for when the button is not in the checked state. |
void |
setTextOn(CharSequence textOn)
Sets the text for when the button is in the checked state. |
| Methods inherited from class android.widget.CompoundButton |
|---|
isChecked, onCreateDrawableState, onDraw, onRestoreInstanceState, onSaveInstanceState, performClick, setButtonDrawable, setButtonDrawable, setOnCheckedChangeListener, setOnCheckedChangeWidgetListener, toggle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ToggleButton(Context context,
AttributeSet attrs,
int defStyle)
public ToggleButton(Context context,
AttributeSet attrs)
public ToggleButton(Context context)
| Method Detail |
|---|
public void setChecked(boolean checked)
CompoundButtonChanges the checked state of this button.
setChecked in interface CheckablesetChecked in class CompoundButtonchecked - true to check the button, false to uncheck itpublic CharSequence getTextOn()
public void setTextOn(CharSequence textOn)
textOn - The text.public CharSequence getTextOff()
public void setTextOff(CharSequence textOff)
textOff - The text.protected void onFinishInflate()
ViewEven if the subclass overrides onFinishInflate, they should always be sure to call the super method, so that we get called.
onFinishInflate in class Viewpublic void setBackgroundDrawable(Drawable d)
ViewView.setPadding(int, int, int, int).
setBackgroundDrawable in class Viewd - The Drawable to use as the background, or null to remove the
backgroundprotected void drawableStateChanged()
ViewBe sure to call through to the superclass when overriding this function.
drawableStateChanged in class CompoundButtonDrawable.setState(int[])
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||