Android7.0中文文档 — CompoundButton

Android7.0中文文档 — CompoundButtonAndroid中文文档CompoundButton

大家好,又见面了,我是你们的朋友全栈君。

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

CompoundButton

public abstract class CompoundButton
extends Button implements Checkable

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


A button with two states, checked and unchecked. When the button is pressed or clicked, the state changes automatically.
拥有选中和未选中这2种状态的按钮。当按钮被按下或点击,状态自动改变。

XML attributes
XML属性

See CompoundButton Attributes, Button Attributes, TextView Attributes, View Attributes
请参考CompoundButton AttributesButton AttributesTextView AttributesView Attributes

摘要


嵌套类

interface CompoundButton.OnCheckedChangeListener

Interface definition for a callback to be invoked when the checked state of a compound button changed. 
回调方法的接口定义,当复合按钮的选择状态发生改变时调用。 

XML属性

android:button drawble,用于图像按钮。 
android:buttonTint 用与按钮图像的tint。 
android:buttonTintMode 混合模式,用于按钮图像着色。 

继承XML属性

Android7.0中文文档 --- CompoundButtonFrom class android.widget.TextView

Android7.0中文文档 --- CompoundButtonFrom class android.view.View

继承常量

Android7.0中文文档 --- CompoundButtonFrom class android.widget.TextView

Android7.0中文文档 --- CompoundButtonFrom class android.view.View

继承字段

Android7.0中文文档 --- CompoundButtonFrom class android.view.View

Public构造方法

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

Public方法

void autoFill(AutoFillValue value)

Automatically fills the content of this view with the value.
value用于自动填充此视图的内容。

void drawableHotspotChanged(float x, float y)

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.
每当视图热点发生改变时,调用此方法,并需要传播到由视图管理的drawable或子视图。

CharSequence getAccessibilityClassName()

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

AutoFillType getAutoFillType()

Describes the auto-fill type that should be used on calls to autoFill(AutoFillValue) and autoFillVirtual(int, AutoFillValue).
描述应用于autoFill(AutoFillValue)autoFillVirtual(int, AutoFillValue)调用的自动填充(auto-fill)类型。

AutoFillValue getAutoFillValue()

Gets the View‘s current auto-fill value.
获取View的当前自动填充(auto-fill)值。

Drawable getButtonDrawable()
ColorStateList getButtonTintList()
PorterDuff.Mode getButtonTintMode()
int getCompoundPaddingLeft()

Returns the left padding of the view, plus space for the left Drawable if any.
返回视图左内边距(padding)的大小,如果有左边Drawable的话,则加上它的空间。

int getCompoundPaddingRight()

Returns the right padding of the view, plus space for the right Drawable if any.
返回视图右内边距(padding)的大小,如果有右边Drawable的话,则加上它的空间。

boolean isChecked()
void jumpDrawablesToCurrentState()

Call Drawable.jumpToCurrentState() on all Drawable objects associated with this view.
在与此视图关联的所有drawable对象上,调用Drawable.jumpToCurrentState()

void onRestoreInstanceState(Parcelable state)

Hook allowing a view to re-apply a representation of its internal state that had previously been generated by onSaveInstanceState().
由应用程序实现,以有机会允许视图重新应用以前由onSaveInstanceState()生成的内部状态。

Parcelable onSaveInstanceState()

Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state.
由应用程序实现,以有机会允许视图生成其内部状态,稍后可用于创建具有相同状态的新实例。

boolean performClick()

Call this view’s OnClickListener, if it is defined.
调用此视图的OnClickListener(如果已经定义)。

void setButtonDrawable(int resId)

Sets a drawable as the compound button image given its resource identifier.
使用指定的资源标识符,为复合按钮(CompoundButton)的图片设置一个drawable。

void setButtonDrawable(Drawable drawable)

Sets a drawable as the compound button image.
为复合按钮(CompoundButton)图片设置一个drawable。

void setButtonTintList(ColorStateList tint)

Applies a tint to the button drawable.
用于按钮drawable的tint。

void setButtonTintMode(PorterDuff.Mode tintMode)

Specifies the blending mode used to apply the tint specified by setButtonTintList(ColorStateList)} to the button drawable.
设置混合模式,用于由setButtonTintList(ColorStateList)指定的按钮drawable的着色。

void setChecked(boolean checked)

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

void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener listener)

Register a callback to be invoked when the checked state of this button changes.
注册一个回调方法,当此按钮的选中状态发生改变时调用。

void toggle()

Change the checked state of the view to the inverse of its current state
改变视图的选中状态,其与当前的状态相反。

保护方法

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/142779.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Virtualenv介绍、基本使用及在Pycharm下配置环境[通俗易懂]

    Virtualenv介绍、基本使用及在Pycharm下配置环境[通俗易懂]Virtualenv是一个创建独立Python运行环境的工具,主要解决Python软件开发过程中版本和依赖性问题。本文对Virtualenv做了简单的介绍、如何建立虚拟环境以及如何在Pycharm下配置Virtualenv环境

    2022年8月28日
    0
  • 群体智能优化算法之总结

    群体智能优化算法之总结获取更多资讯,赶快关注上面的公众号吧!第十六章群体智能优化算法总结总结一下最近一段时间关于群体智能优化算法的文章,这方面的文章目前一共发表了13篇,涉及粒子群(鸟)、人工蜂群、蜘蛛猴、蚁群、布谷鸟、萤火虫群、萤火虫、蝙蝠、鱼群、蟑螂、猫群、细菌觅食和烟花算法,虽然这都是些五花八门的小东西,但也不是无规律可循,这里需要注意的是,群体智能一般是指具有生命的种群(鸟、鱼等),但也有像烟花这样的无…

    2022年5月23日
    32
  • android图片文字识别器,图片转换文字识别器[通俗易懂]

    android图片文字识别器,图片转换文字识别器[通俗易懂]图片转换文字识别器是一款非常好用的功能非常强的图片转换文字手机工具,在图片转换文字识别器软件上有着非常多的功能,用户可以使用这款软件在我们工作中解决很多的问题和麻烦,是一款办公学习必备神器,感兴趣的朋友赶紧下载图片转换文字识别器开始使用吧!图片转换文字识别器软件介绍这款软件的使用方式也是超级简单的只要你想打印文字的图片上传就可以了上传之后,他经过简单的识别,只需要短短几秒之内就可以把你想要打印的文…

    2022年6月3日
    28
  • 数独高级技巧_数独高阶技巧

    数独高级技巧_数独高阶技巧链(Chain)是数独高阶技巧的核心,所有数独盘势都可以通过各种或简单或复杂的链来解出答案。链的本质是命题之间的关系,在解数独时,每个填数的步骤都可表现为在『A格中填入1』、『B格中填入2』这样非真即

    2022年8月4日
    3
  • 嵌入式学习中较好的练手项目和课题整理(附代码资料、学习视频和嵌入式学习规划)[通俗易懂]

    目录:0、引言何为嵌入式?1、单片机相关1.1基于单片机的智能小车、智能机器人制作1.2基于Arduino的3D打印机制作2、嵌入式Linux相关2.1智能扫地机器人2.2智能可穿戴类设备:智能安全头盔2.3智能可穿戴类设备:面向空巢老人/病人的智能手环2.4物联网智能控制系统:家居、农业、医疗2.5基于Linux的嵌入式网络视频监控系统…

    2022年4月6日
    32
  • laravel 共享session问题总结

    laravel 共享session问题总结

    2021年11月7日
    35

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号