私はAndroidNotepadチュートリアルの修正バージョンに取り組んでいます。次のコードは、基本的にすべてのノートのタイトルをテーブル画面に表示するfillData関数からのものですが、わずかに変更されています。
Cursor notesCursor = mDbHelper.fetchAllNotes();
startManagingCursor(notesCursor);
String[] from = new String[]{NotesDbAdapter.KEY_TITLE, NotesDbAdapter.KEY_SPECIAL};
int[] to = new int[]{R.id.text1, R.id.text2};
SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.notes_row, notesCursor, from, to);
setListAdapter(notes);
notes_row.xml
ファイルは非常に単純です。
<TextView
android:id="@+id/text1"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
How can I add @+id/text1
to this XML file so that when the KEY_SPECIAL
field is set to true (or 1), the TextView is bolded? What if I want to use CheckedTextView and get the checkmark instead of bold? How do I write the XML file to look for that input to determine if it's checked originally?