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)
上一篇 2022年5月22日 下午11:40
下一篇 2022年5月22日 下午11:40


相关推荐

  • 详解robots.txt和Robots META标签

    详解robots.txt和Robots META标签对于网站管理者和内容提供者来说,有时候会有一些站点内容,不希望被ROBOTS抓取而公开。为了解决这个问题,ROBOTS开发界提供了两个办法:一个是robots.txt,另一个是The Robots meta标签。 一、 robots.txt1、 什么是robots.txt?  robots.txt是一个纯文本文件,通过在这个文件中声明该网站中不想被robots访问的部分,这样,该网站的部分或全部内

    2022年5月14日
    40
  • 预测算法——指数平滑法

    预测算法——指数平滑法nbsp 目录 1 指数平滑定义及公式 2 一次指数平滑 3 二次指数平滑 4 三次指数平滑 5 指数平滑系数 的确定 1 指数平滑的定义及公式 nbsp nbsp nbsp nbsp 产生背景 指数平滑由布朗提出 他认为时间序列的态势具有稳定性或规则性 所以时间序列可被合理地顺势推延 他认为最近的过去态势 在某种程度上会持续的未来 所以将较大的权数放在最近的资料 nbsp nbsp nbsp nbsp 基本原理 指数平滑法是移动平均法中的一种 其特点在于给过去的

    2026年3月18日
    2
  • Redis集群详解

    Redis集群详解Redis集群详解Redis有三种集群模式,分别是:*主从模式*Sentinel模式*Cluster模式三种集群模式各有特点,关于Redis介绍可以参考这里:NoSQL(二)——RedisRedis官网:https://redis.io/,最新版本5.0.4主从模式主从模式介绍主从模式是三种模式中最简单的,在主从复制中,数据库分为两类:主数据库(master)和从…

    2022年6月13日
    27
  • 属于iscsi使用的命令_tempadm

    属于iscsi使用的命令_tempadm[root@xifenfei~]#fdisk-lDisk/dev/sda:21.4GB,21474836480bytes255heads,63sectors/track,2610cylindersUnits=cylindersof16065*512=8225280bytesDeviceBootStartEndB…

    2022年8月23日
    10
  • spring解析自定义注解_事务的注解@Transactional的属性

    spring解析自定义注解_事务的注解@Transactional的属性前言众所周知,spring从2.5版本以后开始支持使用注解代替繁琐的xml配置,到了springboot更是全面拥抱了注解式配置。平时在使用的时候,点开一些常见的等注解,会发现往往在一

    2022年8月16日
    13
  • 校园智能安防监控解决方案

    校园智能安防监控解决方案目前,我国基本上还处于人防和物防的传统状态,技术防控处于起步阶段,尽管政府和校方不断加大人防和物防的投入并取得了一定的效果,但面对日益复杂多变的校园环境和社会因素,暴力犯罪、偷盗抢劫、意外事件时有发生,加之疫情防控常态化趋势,校园里仍旧存在诸多不可控的安全隐患。为更好的应对校园迫切的安全管控及疫情防控常态化需求,提升校园安全监控能力,是社会和校方迫不及待的需求。基于校园安全防控需求,拟在全市中小学和幼儿园中建立“平安校园”“智慧安防”系统,建设一套智能化、可视化、全方位的视频监控系统,并与公安系统实时联

    2022年6月28日
    31

发表回复

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

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