Need help in using CheckedTextView in android
I have the following in my layout.xml file:
<CheckedTextView
android:id="@+id/checktext"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gra开发者_如何学Pythonvity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:paddingLeft="6dip"
android:paddingRight="6dip"
/>
It shows the 'radio button', but when I call in my onClickListener()?
CheckedTextView numberView2 = (CheckedTextView) v.findViewById(R.id.checktext);
numberView2.setSelected(true);
v.invalidate();
It does not show the 'radio button' as selected. I have stepped via the source code, it does execute 'numberView2.setSelected(true);', but it still does not show the radio button as selected.
Can you please tell me why is that? And how can I fix my problem.
Are you sure you don't want setChecked instead of setSelected?
精彩评论