Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/217.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中使用CheckedTextView需要帮助吗_Android - Fatal编程技术网

在android中使用CheckedTextView需要帮助吗

在android中使用CheckedTextView需要帮助吗,android,Android,我的layout.xml文件中包含以下内容: <CheckedTextView android:id="@+id/checktext" android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:textAppearance="?android:attr/textAppearanceLarge" an

我的layout.xml文件中包含以下内容:

<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"
/>
它不会显示所选的“单选按钮”。我已经通过源代码,它执行'numberView2.setSelected(true);',但它仍然不显示选中的单选按钮


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

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

为什么要使整个父视图无效,而不仅仅是
numberView2
?我不知道。我想尽一切办法让它发挥作用。
CheckedTextView numberView2 = (CheckedTextView) v.findViewById(R.id.checktext);
numberView2.setSelected(true);
v.invalidate();