Android7.0中文文档(API) --- ToggleButton

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ToggleButton.html

ToggleButton

public class ToggleButton
extends CompoundButton

java.lang.Object
   ↳android.view.View
    ↳android.widget.TextView
     ↳android.widget.Button
      ↳android.widget.CompoundButton
       ↳android.widget.ToggleButton


Displays checked/unchecked states as a button with a "light" indicator and by default accompanied with the text "ON" or "OFF".
带“光亮”指示器的按钮,其显示选中/未选中状态,并且默认情况下,还在按钮上显示“ON”或“OFF”文本。

See the Toggle Buttons guide.
请参考Toggle Buttons

摘要


XML属性

android:disabledAlpha当被禁用时,此alpha值将应用于指示器。 
android:textOff当没有被选中时,按钮的文本。 
android:textOn当被选中时,按钮的文本。 

继承XML属性

From class android.widget.CompoundButton
From class android.widget.TextView
From class android.view.View

继承常量

From class android.widget.TextView
From class android.view.View

继承字段

From class android.view.View

Public构造方法

ToggleButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
ToggleButton(Context context, AttributeSet attrs, int defStyleAttr)
ToggleButton(Context context, AttributeSet attrs)
ToggleButton(Context context)

Public方法

CharSequencegetAccessibilityClassName()

Return the class name of this object to be used for accessibility purposes.
返回此对象的类名,用于辅助功能目的。

CharSequencegetTextOff()

Returns the text for when the button is not in the checked state.
返回按钮在非选中状态设置文本。

CharSequencegetTextOn()

Returns the text for when the button is in the checked state.
返回按钮在非选中状态设置文本。

voidsetBackgroundDrawable(Drawable d)

This method is deprecated. use setBackground(Drawable) instead
此方法已取消,使用setBackground(Drawable)替代。

voidsetChecked(boolean checked)

Changes the checked state of this button.
设置此按钮的选中状态。

voidsetTextOff(CharSequence textOff)

Sets the text for when the button is not in the checked state.
为按钮在非选中状态设置文本。

voidsetTextOn(CharSequence textOn)

Sets the text for when the button is in the checked state.
为按钮在选中状态设置文本。

保护方法

voiddrawableStateChanged()

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
每当视图状态发生变化时, 都会调用此方法, 从而影响所显示的drawable的状态。

voidonFinishInflate()

Finalize inflating a view from XML.
完成从XML中加载(inflate)的视图。

继承方法

完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/ToggleButton.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值