Tôi sử dụng bộ chuyển đổi = new SimpleCursorAdapter (điều này, android.R.layout.simple_list_item_multiple_choice, cur, cols, views) để tạo điều khiển trắc nghiệm, nhưng tôi không hài lòng về phong cách của chế độ xem văn bản trong kiểm soát nhiều lựa chọn , vì vậy tôi phải sử dụng đoạn mã sau để tạo bố cục mới của điều khiển trắc nghiệm. Nó hoạt động tốt, nhưng tôi không nghĩ rằng đó là một cách tốt, là có bất kỳ mã tốt? Cảm ơn!Làm cách nào để ghi đè kiểu Android.R.layout.simple_list_item_multiple_choice?
bộ chuyển đổi = new SimpleCursorAdapter (điều này, R.layout.mysimple_list_item_multiple_choice, cur, cols, views);
lv.setAdapter(adapter);
lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
mysimple_list_item_multiple_choice.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:ellipsize="end"
android:singleLine="true"
/>
gothrough 'bộ điều hợp theo yêu cầu' trong android – Pinki