if (itemView == null){
throw new IllegalArgumentException(“item View can not be null!”);
}
this.itemView = itemView;
itemIcon = itemView.findViewById(R.id.rand_icon);
itemNoteTitle = itemView.findViewById(R.id.item_note_title);
itemNoteDate = itemView.findViewById(R.id.item_note_date);
}
时间布局
<TextView
android:id="@+id/item_note_date"
android:layout_width=“match_parent”
android:layout_height=“0dp”
android:layout_weight=“1”
android:textSize=“16sp”
android:gravity=“center_vertical”
android:singleLine=“true”/>
===============================================================
通过标题来模糊查询数据库的数据
private void getSelectNoteList(String title){
noteList.clear();
Cursor allNotes = Note.selectNotes(dbHelper,title);
for (allNotes.moveToFirst(); !allNotes.isAfterLast(); allNotes.moveToNext()){
NoteInfo noteInfo = new NoteInfo();
noteInfo.setId(allNotes.getString(allNotes.getColumnIndex(Note._id)));
noteInfo.setTitle(allNotes.getString(allNotes.getColumnIndex(Note.title)));
noteInfo.setContent(allNotes.getString(allNotes.getColumnIndex(Note.content)));
noteInfo.setDate(allNotes.getString(allNotes.getColumnIndex(Note.time)));
noteList.add(noteInfo);
}
}