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


相关推荐

  • iPhone 抓包工具Charles使用[通俗易懂]

    iPhone 抓包工具Charles使用[通俗易懂]Charles是在Mac下常用的截取网络封包的工具,在做iOS开发时,我们为了调试与服务器端的网络通讯协议,常常需要截取网络封包来分析。Charles通过将自己设置成系统的网络访问代理服务器,使得所有的网络访问请求都通过它来完成,从而实现了网络封包的截取和分析。Charles主要的功能包括:支持SSL代理。可以截取分析SSL的请求。支持流量控制。可以模拟慢速网络

    2022年5月16日
    546
  • findIndex()方法[通俗易懂]

    findIndex()方法[通俗易懂]findIndex()方法返回数组中通过测试的第一个元素的索引(作为函数提供)。findIndex()方法对数组中存在的每个元素执行一次函数:如果找到函数返回true值的数组元素,则findIndex()返回该数组元素的索引(并且不检查剩余值)否则返回-1注释:findIndex()不会为没有值的数组元素执行函数。注释:findIndex()不会改变原始数组。获取数组中第一个值等于或大于18的元素的索引:varages=[3,10,18,20];funct

    2025年7月22日
    4
  • 使用R中merge()函数合并数据[通俗易懂]

    使用R中merge()函数合并数据[通俗易懂]使用R中merge()函数合并数据在R中可以使用merge()函数去合并数据框,其强大之处在于在两个不同的数据框中标识共同的列或行。如何使用merge()获取数据集中交叉部分merge()最简单的形式为获取两个不同数据框中交叉部分。举例,获取cold.states和large.states完全匹配的数据。代码如下:>merge(cold.states,large….

    2022年6月14日
    52
  • 分类模型评估之ROC-AUC曲线和PRC曲线

    分类模型评估之ROC-AUC曲线和PRC曲线http://blog.csdn.net/pipisorry/article/details/51788927ROC曲线和AUCROC(ReceiverOperatingCharacteristic,接受者工作特征曲线)曲线和AUC常被用来评价一个二值分类器(binaryclassifier)的优劣。博文介绍ROC和AUC的特点,讨论如何作出ROC曲线图以及计算AUC。AUC是现…

    2022年5月17日
    57
  • 均值归一化详解_matlab数据归一化

    均值归一化详解_matlab数据归一化数据归一化[TOC]将所有的数据映射到同一尺度。​首先,为什么需要数据归一化?举个简答的例子。样本间的距离时间所主导,这样在样本1以[1,200]输入到模型中去的时候,由于200可能会直接忽略到1的存在,因此我们需要将数据进行归一化。比如将天数转换为占比1年的比例,200/365=0.5479,100/365=0.2740。一、最值归一化最值归一化(Nor…

    2022年10月11日
    11
  • c++ CreateThread

    c++ CreateThread1.基本使用方式1.1DWORDWINAPI函数名(LPVOIDlpParam);//标准格式DWORDWINAPI函数名(LPVOIDlpParam){return0;}CreateThread(NULL,0,函数名,0,0,0);1.2使用void函数名()此种线程声明方式时,lpStartAddress需要加入LPTHREAD_START_ROUTINE转换void函数名(){return;}CreateThre

    2022年7月21日
    14

发表回复

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

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