第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

recyclerview.onBindviewholder 始終處于位置 0

recyclerview.onBindviewholder 始終處于位置 0

MYYA 2024-01-17 21:02:46
recyclerview.onbindviewholder始終處于位置 0public class NoteAdapter extends RecyclerView.Adapter<NoteAdapter.ViewHolder> {    public static final int UNCOMPLETED = 0;    public static final int COMPLETED = 1;    public static final int HIGHTLIGHT = 2;    public static final int HIGHTLIGHT_COMPETED = 3;    Cursor cursor;    Context context;    public NoteAdapter(Context context, Cursor cursor) {        this.context = context;        this.cursor = cursor;    }    public Cursor getCursor() {        return this.cursor;    }    public void setCursor(Cursor cursor) {        this.cursor = cursor;    }    public Context getContext() {        return context;    }    public void setContext(Context context) {        this.context = context;    }    @Override    public int getItemViewType(int position) {        if (cursor.moveToPosition(position)) {            cursor.move(position);            String content = cursor.getString(cursor.getColumnIndex(DatabaseHandler.KEY_CONTENT));            int completed = cursor.getInt(cursor.getColumnIndex(DatabaseHandler.KEY_COMPLETED));            int hightlight = cursor.getInt(cursor.getColumnIndex(DatabaseHandler.KEY_HIGHTLIGHT));            if (completed == 1) {                if (hightlight == 1) {                    return HIGHTLIGHT_COMPETED;                }                return COMPLETED;            }            if (hightlight == 1 && completed == 0) {                return HIGHTLIGHT;            }            return UNCOMPLETED;        }        return -1;    }該程序不包含任何錯(cuò)誤。當(dāng)我運(yùn)行程序時(shí),它總是只顯示0位置的元素,其余位置不顯示。函數(shù)getItemCount正常工作,返回 20 個(gè)元素。英語(yǔ)不是我的母語(yǔ),很抱歉有任何語(yǔ)法錯(cuò)誤。感謝大家。
查看完整描述

1 回答

?
慕斯王

TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超2個(gè)贊

確保android:layout_height各種 ViewHolders 的布局(xml)文件中的父布局已設(shè)置wrap_content為而不是match_parent



查看完整回答
反對(duì) 回復(fù) 2024-01-17
  • 1 回答
  • 0 關(guān)注
  • 208 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)