プログラムでリストアイテムのビューを作成しようとしています-元のAndroidチェックボックステンプレートに類似している必要があります-Androidの元のテンプレートxmlは次のとおりです。
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:checkMark="?android:attr/textCheckMark"
android:paddingLeft="6dip"
android:paddingRight="6dip"
/>
これが私の情報源です:
CheckedTextView ctv = new CheckedTextView(context);
ctv.setId(CTV_ID);
ctv.setCheckMarkDrawable(android.R.attr.textCheckMark);
ctv.setPadding(Utils.toDP(4, context), Utils.toDP(4, context), Utils.toDP(4, context), Utils.toDP(4, context));
問題はsetCheckMarkDrawable
回線にあります。例外が発生します。
android.content.res.Resources$NotFoundException: Resource ID #0x1010046
私のコードがこのリソースにアクセスできないことは明らかです。私は何をすべきか、私は何を間違っているのか、これを修正する方法は?