在主Activity中:
成都創(chuàng)新互聯(lián)公司是專業(yè)的鹽城網(wǎng)站建設(shè)公司,鹽城接單;提供網(wǎng)站建設(shè)、網(wǎng)站制作,網(wǎng)頁設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行鹽城網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
listview=(ListView)findViewById(R.id.listview);getData();
//為list添加數(shù)據(jù)overrideSimpleAdapter=new OverrideSimpleAdapter(getContext(),list,R.layout.list_item_layout,
new String[]{"num","word","translates"},
new int[]{R.id.tv_num,R.id.tv_word,R.id.tv_translates});
listview.setAdapter(overrideSimpleAdapter);
重寫SimpleAdapter:/**
* Created by KewenC on 2017/1/26.
*/
public class OverrideSimpleAdapter extends SimpleAdapter {
/**
* Constructor
*
* @param context The context where the View associated with this SimpleAdapter is running
* @param data A List of Maps. Each entry in the List corresponds to one row in the list. The
* Maps contain the data for each row, and should include all the entries specified in
* "from"
* @param resource Resource identifier of a view layout that defines the views for this list
* item. The layout file should include at least those named views defined in "to"
* @param from A list of column names that will be added to the Map associated with each
* item.
* @param to The views that should display column in the "from" parameter. These should all be
* TextViews. The first N views in this list are given the values of the first N columns
*/
private LayoutInflater mInflater;
private ArrayList
以上這篇優(yōu)化SimpleAdapter適配器加載效率的方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持創(chuàng)新互聯(lián)。
文章標(biāo)題:優(yōu)化SimpleAdapter適配器加載效率的方法
鏈接地址:
http://weahome.cn/article/gcjoco.html