1.初学android,某个任务需将checkbox信息放入textview显示,一开始怎么也解决不了,网上搜索实时更新,找到的多是高度复杂,要不直接只有布局。
后隔一天突然想到可将其视为一种点击态,单数次显示,双数时空值覆盖,完成该任务。
现将示例代码贴下:
2.layout布局部分:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<CheckBox
android:id="@+id/ckbox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="点我啊~">
</CheckBox>
<TextView android:id=&#