CheckBox没有出现在CheckedTextView中

Cg2*_*916 10 android android-checkbox android-relativelayout

当我设置我的时候CheckedTextView,它没有CheckBox.这是它的xml代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
    <CheckedTextView
            android:id="@+id/checkedtext"
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:checked="false"
            android:textSize="25dp"
            android:textColor="#FFFFFF"
            android:checkMark="@android:attr/checkMark"
            />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

lin*_*sax 27

试试:android:checkMark ="?android:attr/listChoiceIndicatorMultiple"

  • 这给了我正确的图像,接受的答案没有 (4认同)

Eri*_*rch 15

更换

android:checkMark="@android:attr/checkMark"
Run Code Online (Sandbox Code Playgroud)

通过

android:checkMark="?android:attr/textCheckMark" 
Run Code Online (Sandbox Code Playgroud)

  • 试试`android:checkMark ="?android:attr/listChoiceIndicatorMultiple"`如果仍然抛出异常,请附上你的java代码和完整的堆栈跟踪 (5认同)