在使用CheckedTextView需要帮助的android

问题描述:

我在layout.xml文件中的以下内容:当我打电话,我onClickListener()在使用CheckedTextView需要帮助的android

<CheckedTextView 
    android:id="@+id/checktext" 
    android:layout_width="fill_parent" 
    android:layout_height="?android:attr/listPreferredItemHeight" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:gravity="center_vertical" 
    android:checkMark="?android:attr/listChoiceIndicatorSingle" 
    android:paddingLeft="6dip" 
    android:paddingRight="6dip" 
/> 

它显示“单选按钮”,但?

CheckedTextView numberView2 = (CheckedTextView) v.findViewById(R.id.checktext); 
numberView2.setSelected(true); 
v.invalidate(); 

它没有显示'单选按钮'被选中。我已经通过源代码步进,它执行'numberView2.setSelected(true);',但它仍然没有显示单选按钮被选中。

你能告诉我为什么?我该如何解决我的问题。

+0

你为什么使整个父视图无效而不仅仅是'numberView2'? – 2009-11-03 20:48:02

+0

我不知道。我正在尝试所有我能想到的方法来实现它。 – hap497 2009-11-03 22:23:33

你确定你不想setChecked而不是setSelected?