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

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

ExpandableListview :想在每個(gè)組下添加子列表延遲加載

ExpandableListview :想在每個(gè)組下添加子列表延遲加載

我已經(jīng)實(shí)現(xiàn)了 expandablelistview 并且工作正常?,F(xiàn)在我想在每個(gè)子列表的末尾添加“加載更多”按鈕,這樣如果用戶單擊它,它將從服務(wù)器獲取更多項(xiàng)目。無(wú)論如何要這樣做,因?yàn)樵谒阉髁撕芏嘀笪艺也坏饺魏螙|西。非常感謝任何指導(dǎo)。這是我的自定義適配器:public class ExpandableListAdapterAssets extends BaseExpandableListAdapter implements Filterable {List<View> groupViews;ItemFilter mFilter;boolean showCheckBox;ArrayList<Asset> assetsToClaim;private Context _context;private List<AssetCategory> _listDataHeader; // header titles// child data in format of header title, child titleprivate HashMap<Integer, List<Asset>> _listDataChild;private RequestBackendHelper requestBackendHelper;public ExpandableListAdapterAssets(Context context, List<AssetCategory> listDataHeader,                                   HashMap<Integer, List<Asset>> listChildData, boolean b){    this._context = context;    this._listDataHeader = listDataHeader;    this._listDataChild = listChildData;    groupViews = new ArrayList<>();    showCheckBox = b;    assetsToClaim = new ArrayList<>();}@Overridepublic Asset getChild(int groupPosition, int childPosition){    return this._listDataChild.get(this._listDataHeader.get(groupPosition).getId())            .get(childPosition);}public List<Asset> getChildList(int groupPosition){    return this._listDataChild.get(this._listDataHeader.get(groupPosition).getId());}@Overridepublic long getChildId(int groupPosition, int childPosition){    return childPosition;}@Overridepublic View getChildView(final int groupPosition, final int childPosition,                         boolean isLastChild, View convertView, ViewGroup parent){    final Asset assetChild = getChild(groupPosition, childPosition);    if (convertView == null)    {        LayoutInflater infalInflater = (LayoutInflater) this._context                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);        convertView = infalInflater.inflate(R.layout.list_item, null);    }    TextView assetName = (TextView) convertView            .findViewById(R.id.txt_asset_name);    assetName.setText(assetChild.getName());
查看完整描述

1 回答

?
慕斯王

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

您需要插入帶有自定義的“加載更多”按鈕BaseExpandableAdapter。這個(gè)答案似乎是相關(guān)的,因?yàn)樗故玖巳绾翁峁﹥煞N不同類(lèi)型的子視圖。棘手的是,當(dāng)單擊“加載更多”按鈕時(shí),必須將其刪除,然后需要將新項(xiàng)目與底部的新“加載更多”按鈕連接在一起 - 然后是子適配器需要通知。它必須表現(xiàn)得像一個(gè)虛擬列表項(xiàng),其中getChildView()提供當(dāng)前的childPosition.

剛剛看到提供的代碼;使用 Volley,您很可能需要在第一次加載時(shí)少獲取一個(gè)項(xiàng)目,這樣適配器就不會(huì)由于添加了一個(gè)額外的虛擬項(xiàng)目而失去同步 - 或者至少在最后添加視圖類(lèi)型 2在將網(wǎng)絡(luò)請(qǐng)求添加到適配器之前。另一種選擇可能是讓getChildCount()回報(bào)少一個(gè);在分頁(yè)時(shí)必須注意每種情況下的這個(gè)附加項(xiàng)目。


查看完整回答
反對(duì) 回復(fù) 2022-07-14
  • 1 回答
  • 0 關(guān)注
  • 127 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(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)