我已經通過使用懶惰列表concept.i想要分配的所有字符串數組值從LazyAdapter文本視圖實現示例應用程序(延伸BaseAdapter)類工作與LazyList問題
如下
我已經使用這個類public class LazyAdapter extends BaseAdapter {
private Activity activity;
private String[] data;
private static LayoutInflater inflater=null;
public ImageLoader imageLoader;
public LazyAdapter(Activity a, String[] d) {
activity = a;
data=d;
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
imageLoader=new ImageLoader(activity.getApplicationContext());
}
public int getCount() {
return data.length;
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.item, null);
String texts[]={"hai","how are you","hello","oyeeee"};
//i would like to set this texts[] values to TextView
for(int i=0;i< texts.size();i++)
{
TextView text=(TextView)vi.findViewById(R.id.text);;
ImageView image=(ImageView)vi.findViewById(R.id.image);
text.setText("item "+texts[i]);
imageLoader.DisplayImage(data[position], activity, image);
}
return vi;
}
}
在這裏,我能夠只顯示我oyeee.how可以查看所有值列表
這裏我怎麼可以在列表中顯示的所有字符串數組值就像懶列表,我們顯示item0,物品1, item2,....等,
我只從字符串數組中獲取海字符串 –
在您的代碼中完全顯示圖像。 –