码迷,mamicode.com
首页 > 其他好文 > 详细

ArrayAdapter的使用

时间:2014-12-01 16:15:44      阅读:577      评论:0      收藏:0      [点我收藏+]

标签:adapter

各种Adapter的用法(适配器)

*同样是一个ListView,可以用不同的Adapter让它显示出来,比如说最常用的ArrayAdapter, SimpleAdapter,BaseAdapter.

 android.widget.ArrayAdapter<string>

A concrete BaseAdapter that is backed by an array of arbitrary objects. By 
default this class expects that the provided resource id references a single 
TextView. If you want to use a more complex layout, use the constructors that 
also takes a field id. That field id should reference a TextView in the larger 
layout resource.
However the TextView is referenced, it will be filled with the toString() of 
each object in the array. You can add lists or arrays of custom objects. 
Override the toString() method of your objects to determine what text will be 
displayed for the item in the list.
To use something other than TextViews for the array display, for instance, 
ImageViews, or to have some of data besides toString() results fill the views, 
override getView(int, 
View, ViewGroup) to return the type of view you want.


ArrayAdapter的使用

标签:adapter

原文地址:http://623411589.blog.51cto.com/9215003/1584988

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!