blob: ff63a249d76917f1fdd4b5e9f2878a79ddbf537f [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2006 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.widget;
18
19import android.content.Context;
20import android.util.AttributeSet;
21
22
23/**
24 * <p>
25 * A checkbox is a specific type of two-states button that can be either
26 * checked or unchecked. A example usage of a checkbox inside your activity
27 * would be the following:
28 * </p>
29 *
30 * <pre class="prettyprint">
31 * public class MyActivity extends Activity {
32 * protected void onCreate(Bundle icicle) {
33 * super.onCreate(icicle);
34 *
35 * setContentView(R.layout.content_layout_id);
36 *
37 * final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
38 * if (checkBox.isChecked()) {
39 * checkBox.setChecked(false);
40 * }
41 * }
42 * }
43 * </pre>
44 *
45 * <p><strong>XML attributes</strong></p>
46 * <p>
47 * See {@link android.R.styleable#CompoundButton CompoundButton Attributes},
48 * {@link android.R.styleable#Button Button Attributes},
49 * {@link android.R.styleable#TextView TextView Attributes},
50 * {@link android.R.styleable#View View Attributes}
51 * </p>
52 */
53public class CheckBox extends CompoundButton {
54 public CheckBox(Context context) {
55 this(context, null);
56 }
57
58 public CheckBox(Context context, AttributeSet attrs) {
59 this(context, attrs, com.android.internal.R.attr.checkboxStyle);
60 }
61
62 public CheckBox(Context context, AttributeSet attrs, int defStyle) {
63 super(context, attrs, defStyle);
64 }
65}