5 개의 TabHost.TabSpec이 포함 된 TabHost가 있습니다. 각 TabSpec은 sqlite3 데이터베이스 인 데이터 소스로 SimpleCursorAdapter를 사용하여 채워진 ListView입니다.Android : CheckBox의 ListView가있는 TabHost
SimpleCursorAdapter에서 사용되는 레이아웃에는 데이터베이스 데이터를 보유하는 2 개의 TextView가 포함됩니다 (숨겨진 하나 - 데이터베이스 레코드 _id가 있고 하나는 표시됨). 세 번째 위젯은 CheckBox입니다. 아래 레이아웃을 참조하십시오.
<RelativeLayout
android:id="@+id/favoriteRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:id="@+id/text0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:paddingLeft="5px">
</TextView>
<TextView
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/text0"
android:textColor="@color/listTextColor"
android:textSize="@dimen/font_size_for_show_row"
android:paddingTop="@dimen/vertical_padding_for_show_row"
android:paddingBottom="@dimen/vertical_padding_for_show_row">
</TextView>
<com.example.subclass.FavoriteCheckBox
android:text=""
android:id="@+id/favorite_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:checked="false">
</com.example.subclass.FavoriteCheckBox>
</RelativeLayout>
내 주요 문제는 사용자가 CheckBox에서 '클릭'할 때 어떻게 캡처/수신 대기하는지 파악할 수 없다는 것입니다. CheckBox에 서브 클래스 FavoriteCheckBox
을 추가하고 protected void onClick(View v)
을 추가했지만 확인란을 클릭하면 결코 표시되지 않습니다.
제가 누락 된 부분에 대한 제안.
TIA,
JB