上一篇文章中学习了RadioButton。知道了RadionButton的基本用法,实现起来也是听简单的
和RadioButton一样CheckBox也是一个使用的非常多的控件,Android中它的的用法也挺简单的。
以一个例子程序为例:
同样先看一个常规的实现:
布局文件如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CheckBox演示"
android:layout_gravity="c