优化SimpleAdapter适配器加载效率的方法
在主Activity中:
成都创新互联公司是专业的盐城网站建设公司,盐城接单;提供网站建设、网站制作,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行盐城网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
listview=(ListView)findViewById(R.id.listview);getData();
//为list添加数据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
以上这篇优化SimpleAdapter适配器加载效率的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持创新互联。
网站栏目:优化SimpleAdapter适配器加载效率的方法
文章链接:
http://dzwzjz.com/article/gcjoco.html