[英]Custom CursorAdapter to bind to simple_list_item_checked
例如,假設我有一個待辦事項的SQLite數據庫,每個數據庫都有一個字符串標題和一個完整的整數。 如何創建自定義適配器(擴展了CursorAdaper)以將android.R.layout.simple_list_item_checked
的復選框綁定到已完成的整數? 我已經知道我必須將整數轉換為布爾值,我使用的是true = 1和false = 0。
請在您的適配器中重寫bindView抽象方法。
/**
* Bind an existing view to the data pointed to by cursor
* @param view Existing view, returned earlier by newView
* @param context Interface to application's global information
* @param cursor The cursor from which to get the data. The cursor is already
* moved to the correct position.
*/
public abstract void bindView(View view, Context context, Cursor cursor);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.