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


相关推荐

  • Centos7离线安装autoconf

    Centos7离线安装autoconf文章目录1.安装步骤1.1安装M41.2安装perl的依赖包perl-Data-Dumper1.3安装autoconf2.安装过程参考1.安装步骤1.1安装M4下载:http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gz拷贝到centos系统上,并解压:tar-xzvfm4-1.4.13.tar.gz到解压目录中:cdm4-1.4.13#配置编译环境./configure–prefix=/usr/local#编

    2022年6月4日
    57
  • idea2021.8激活码【永久激活】[通俗易懂]

    (idea2021.8激活码)2021最新分享一个能用的的激活码出来,希望能帮到需要激活的朋友。目前这个是能用的,但是用的人多了之后也会失效,会不定时更新的,大家持续关注此网站~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月22日
    58
  • 手把手教你安装黑苹果之openCore-0.6.3 EFI制作全过程,非常详细

    手把手教你安装黑苹果之openCore-0.6.3 EFI制作全过程,非常详细文章目录前言一、EFI是什么?二、获取EFI1.Hackintosh黑苹果长期维护机型整理清单2.搜索efi二、自制EFI总结前言这篇文章主要是记录自己动手安装BigSur在过程,和心理。略显繁琐,请自行跳跃观看。macOSBigSur正式版于11月12日星期四(北京时间11月13日)发布,改动还是挺大的。基于M1苹果自研芯片的macbook也发布了,看了各种up主的评测,网上一堆好评。我馋了好久了,奈何囊中羞涩。等我有钱了,一定要买macbook。看了一眼跟了我6年之前的

    2022年6月24日
    275
  • pycharm代码自动换行_vba自动换行代码

    pycharm代码自动换行_vba自动换行代码打开Pycharm点击File,选择Settings选择General,勾选Usesoftwrapsineditor和Useoriginalline’sindentforwrappedparts,点ok再看代码,如果代码超出可视范围,会自动换行并出现标识,即成功…

    2022年8月25日
    10
  • ora00279解决办法_oracle物化视图日志表

    ora00279解决办法_oracle物化视图日志表某物化视图在增量刷新的时候报错ora-00920,尝试全量刷新的时候,报错ora-00904。BEGINDBMS_MVIEW.REFRESH(‘MV_ABCD_K_PPLLCJ’,’F’);END;ORA-12018:在创建”MYJUKKA”.”MV_ABCD_K_PPLLCJ”的代码时出现以下错误ORA-00920:无效的关系运算符ORA-06512:在”SYS.SNAPSHOT”,line…

    2022年9月20日
    3
  • 真正的趋势之王指标_accer指标优点缺点

    真正的趋势之王指标_accer指标优点缺点四个基本概念TP、TruePositive真阳性:预测为正,实际也为正FP、FalsePositive假阳性:预测为正,实际为负FN、FalseNegative假阴性:预测与负、实际为正TN、TrueNegative真阴性:预测为负、实际也为负。【一致判真假,预测判阴阳。】以分类问题为例:(word公式为什么粘不过来??头疼。)…

    2022年8月31日
    5

发表回复

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

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