构造方法:
官方对每个参数的解释:
我所理解的:
Context参数:一般是本类.this
data参数:里是个装有map的List参数
比如:
resource参数:每个map所展示的方式 ,即map布局
from 和 to参数:是将参数map里的key和map布局里的id关联起来
比如:
public SimpleAdapter (Context context, List<? extends Map<String, ?>> data, int resource, String[] from, int[] to)
官方对每个参数的解释:
context The context where the View associated with this SimpleAdapter is running
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"
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"
from A list of column names that will be added to the Map associated with each item.
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 in the from parameter.
我所理解的:
Context参数:一般是本类.this
data参数:里是个装有map的List参数
比如:
ArrayList data = new ArrayList();
HashMap map = new HashMap();
map.put("itemImage",R.drawable.menu_new_user);
map.put("itemText","增加");
data.add(map);
resource参数:每个map所展示的方式 ,即map布局
from 和 to参数:是将参数map里的key和map布局里的id关联起来
比如:
SimpleAdapter adapter = new SimpleAdapter(MainActivity.this, data, R.layout.item_menu,
new String[]{"itemImage","itemText"}, new int[]{R.id.btn_img,R.id.item_text});