我有一个 ListView 显示带有图像的新闻,并设置何时(位置 == 0)更改布局,然后为以下新闻设置一个普通的 listview_row,但这仅适用于屏幕上显示的 3 个项目,然后位置返回到0 并再次更改视图,这里有什么帮助吗?
这是我的lazyAdapter代码,
vi = convertView;
Log.d("NOTICIAS", "P0sition: " + position);
// set Layout for 1rst item
if (convertView==null && position == 0) {
vi = inflater.inflate(R.layout.noticias_list_item_first, null);
}
// set layout for the next items
else if(convertView==null && position != 0){
vi = inflater.inflate(R.layout.noticias_list_item, null);
}
TextView news_id = (TextView)vi.findViewById(R.id.news_id); // news_id
TextView news_titulo = (TextView)vi.findViewById(R.id.news_titulo); // news_titulo
TextView news_desc = (TextView)vi.findViewById(R.id.news_desc); // news_desc
//TextView news_fecha = (TextView)vi.findViewById(R.id.news_fecha); // news_fecha
ImageView news_img = (ImageView)vi.findViewById(R.id.news_img); // news_img
HashMap<String, String> news = new HashMap<String, String>();
news = data.get(position);
// Setting all values in listview
news_id.setText(news.get(NoticiasActivity.TAG_NEWS_ID));
news_titulo.setText(news.get(NoticiasActivity.TAG_NEWS_TITULO));
news_desc.setText(news.get(NoticiasActivity.TAG_NEWS_DESC));
//news_fecha.setText(song.get(NoticiasActivity.TAG_NEWS_FECHA));
imageLoader.DisplayImage(news.get(NoticiasActivity.TAG_NEWS_IMG), news_img);
return vi;