Added in API level 1

CheckBox

open class CheckBox : CompoundButton
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Button
   ↳ android.widget.CompoundButton
   ↳ android.widget.CheckBox

A checkbox is a specific type of two-states button that can be either checked or unchecked. A example usage of a checkbox inside your activity would be the following:

public class MyActivity extends Activity {
      protected void onCreate(Bundle icicle) {
          super.onCreate(icicle);
 
          setContentView(R.layout.content_layout_id);
 
          final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
          if (checkBox.isChecked()) {
              checkBox.setChecked(false);
          }
      }
  }
  

See the Checkboxes guide.

XML attributes

See CompoundButton Attributes, Button Attributes, TextView Attributes, View Attributes

Summary

Inherited XML attributes
Inherited constants
Public constructors
CheckBox(context: Context!)

CheckBox(context: Context!, attrs: AttributeSet!)

CheckBox(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

CheckBox(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open CharSequence!

Inherited functions
Inherited properties

Public constructors

CheckBox

Added in API level 1
CheckBox(context: Context!)

CheckBox

Added in API level 1
CheckBox(
    context: Context!,
    attrs: AttributeSet!)

CheckBox

Added in API level 1
CheckBox(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

CheckBox

Added in API level 1
CheckBox(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!