0
我正在修改Android記事本教程的版本。下面的代碼是從fillData功能基本上顯示錶屏幕上的所有筆記的標題,略作修改:將顯示設置添加到Android TextView
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"/>
我怎樣才能將@+id/text1
添加到此XML文件,以便當KEY_SPECIAL
字段設置爲true(或1)時,TextView變粗體?如果我想使用CheckedTextView並獲得複選標記而不是粗體怎麼辦?如何編寫XML文件以查找該輸入以確定它是否最初被檢查?