2010-05-28 12 views
20

görünmüyor. Kontrol edilen metin görünümünü nasıl ayarlayacağım. Nasıl bir onay kutusu görünmedi?Onay kutumda CheckedTextView

Ayrıca bunu ekledim ama etki yapmamıştı: listView.setChoiceMode (ListView.CHOICE_MODE_SINGLE);

Bu yeterli değil

<CheckedTextView 
android:id="@+id/ctv_checktext" 
android:layout_width="fill_parent" 
android:paddingLeft="2px" 
android:paddingRight="2px" 
android:paddingTop="2px" 
android:layout_height="wrap_content" 
/> 

cevap

49

(o Android API belgesiz çünkü benim kendi soru yanıtlama):

Sen android eklemeniz gerekir
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); 

: onay işareti = "? android: attr/listChoiceIndicatorMultiple" veya başka

<CheckedTextView 
android:id="@+id/ctv_checktext" 
android:layout_width="fill_parent" 
android:paddingLeft="2px" 
android:paddingRight="2px" 
android:paddingTop="2px" 
android:layout_height="wrap_content" 
android:checkMark="?android:attr/listChoiceIndicatorMultiple" 
/> 
Eğer y olabilir
+1

xml olmadan kodda bunu nasıl yapabiliriz? – guness

+2

CheckedEditText belgeleri, ilgili yöntemi tanımlar (http://developer.android.com/reference/android/widget/CheckedTextView.html#attr_android:checkMark). Bu örnekte: 'checkedEditText.setCheckMarkDrawable (android.R.attr.listChoiceIndicatorMultiple);' – WonderCsabo

1

çekilebilir klasörde kendi checkbox.xml sonra android olarak yazabilirsiniz: checkMark = "@ çekilebilir/onay kutusu"

İlgili konular