<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > android ListView只加載當前屏幕顯示的圖片(解決List滑動(dòng)時(shí)加載卡頓)

android ListView只加載當前屏幕顯示的圖片(解決List滑動(dòng)時(shí)加載卡頓)

作者: 時(shí)間:2018-09-04 來(lái)源:網(wǎng)絡(luò ) 收藏

之前寫(xiě)過(guò)一個(gè)關(guān)于ListView異步加載網(wǎng)絡(luò )圖片的文章:http://blog.sina.com.cn/s/blog_7033e38201010req.html,但是使用時(shí)發(fā)現如果快速滑動(dòng)List,因為正在加載圖片,會(huì )有點(diǎn)卡。這時(shí)我們就希望能夠只加載當前屏幕顯示的Item的圖片。

本文引用地址:http://dyxdggzs.com/article/201809/388380.htm

廢話(huà)不多少,直接粘貼代碼:

listView.setOnScrollListener(new OnScrollListener() {

@Override

public void onScrollStateChanged(AbsListView view, int scrollState) {

// TODO Auto-generated method stub

// 異步加載圖片

if (scrollState == OnScrollListener.SCROLL_STATE_IDLE) {//list停止滾動(dòng)時(shí)加載圖片

pageImgLoad(_start_index, _end_index);

}

}

@Override

public void onScroll(AbsListView view, int firstVisibleItem,

int visibleItemCount, int totalItemCount) {

// TODO Auto-generated method stub

//設置當前屏幕顯示的起始index和結束index

_start_index = firstVisibleItem;

_end_index = firstVisibleItem + visibleItemCount;

if (_end_index >= totalItemCount) {

_end_index = totalItemCount - 1;

}

}

});

private void pageImgLoad(int start_index, int end_index) {

for (; start_index end_index; start_index++) {

HashMap

if (curr_item.get(Constant.NEWS_ICON_URL) != null

curr_item.get(Constant.NEWS_ICON) == null) {

loadImage(curr_item);

}

}

}



關(guān)鍵詞:

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>