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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Vue substring截取字符串报错

    Vue substring截取字符串报错这是我查出来的订单信息对象,当我只需要显示用户电话的前三位和后四位时,就需要对订单进行截取。可是当我这样截取之后,效果是出来了,只是控制台依然报错;原因:因为数据是异步加载的,当数据还没出来的时候,数据是空的,所以会报错解决办法:这是我一开始用来保存查出来的数据对象。但是这样依然会报错。我们只需要把这个对象需要截取的那个属性一开始赋值为空,这样就不会报错了。…

    2022年5月23日
    36
  • 海量数据存储技术(cpu制造瓶颈)

    对于海量数据的处理随着互联网应用的广泛普及,海量数据的存储和访问成为了系统设计的瓶颈问题。对于一个大型的互联网应用,每天几十亿的PV无疑对数据库造成了相当高的负载。对于系统的稳定性和扩展性造成了极大的问题。通过数据切分来提高网站性能,横向扩展数据层已经成为架构研发人员首选的方式。水平切分数据库:可以降低单台机器的负载,同时最大限度的降低了宕机造成的损失;负载均衡策略:可以降低单台机器的访问负载,降…

    2022年4月14日
    52
  • 复制集让mongodb的secondary支持读操作,因为存在读写延迟所以是否需要读写分离

    复制集让mongodb的secondary支持读操作,因为存在读写延迟所以是否需要读写分离复制集让mongodb的secondary支持读操作,因为存在读写延迟所以是否需要读写分离

    2022年4月24日
    65
  • Springboot-软件授权License

    Springboot-软件授权License在我们做系统级框架的时候,我们要一定程度上考虑系统的使用版权,不能随便一个人拿去在任何环境都能用,所以我们需要给我们系统做一个授权认证机制,只有上传了我们下发的lic文件并验证通过,才能正常使用。1、Smart-license简介smart-license是一款用于安全加固的开源项目。主要服务于非开源产品、商业软件、具备试用功能的付费软件等,为软件提供授权制的使用方式。1.License,通过smart-license生成的授权文件,导入至要授权使用的软件产品中。2.源数据,需要进行L

    2022年7月26日
    27
  • 前端开发项目经验_项目管理体系包括哪些

    前端开发项目经验_项目管理体系包括哪些前端开发传统的web开发管理端、H5/小程序、可视化、游戏等Node.js开发服务端接入层、构建工具、云服务等终端开发reactnative、flutter、electron等项目开发过程中涉及的系统涉及、方案调研、技术选型、性能优化、效能提升这些都是想通的这是怎样的一个项目?他遇到什么问题、存在着怎样的瓶颈?又需要怎么去解决?前端面试相关知识点前端常见的框架和工具库重要的是要知道各个框架的区别、掌握框架设计和实现原理Node.js和服务.

    2022年10月21日
    3
  • 删除多选框选中商品的内容_快速选择工具怎么删除选中部分吗

    删除多选框选中商品的内容_快速选择工具怎么删除选中部分吗多选框定义多选框的出现时将商品循环多次出现,这里用到了el表达式和jstl标签库的foreEach标签,注意input框加上class属性,并加上存有id的属性value:forEachitems=”${productList}”var=”product”varStatus=”vs”>type=”checkbox”class=”check_pid”name=”pid”

    2025年5月31日
    2

发表回复

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

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