下午好! listview不会在某些设备上显示某些项目。在某些物品之间有空的空间。
Imageview(我正在使用通用图像加载器)和textview正在加载互联网。 如果降低服务器上图像的质量,则项目为。我不明白它是如何运作的
getView:
View v = convertView;
ViewHolder viewHolder;
if (v == null) {
viewHolder = new ViewHolder();
v = LayoutInflater.from(context).inflate(R.layout.new_layout_item, null);
viewHolder.text_group = (TextView) v.findViewById(R.id.group);
viewHolder.text_date = (TextView) v.findViewById(R.id.date);
viewHolder.title = (TextView) v.findViewById(R.id.title);
viewHolder.text = (TextView) v.findViewById(R.id.content);
viewHolder.author = (TextView) v.findViewById(R.id.author);
viewHolder.addition = (TextView) v.findViewById(R.id.addition);
viewHolder.img = (ImageView) v.findViewById(R.id.image);
viewHolder.ico_group = (ImageView) v.findViewById(R.id.ico_group);
viewHolder.text_group.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-M.ttf"));
viewHolder.text_date.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-N.ttf"));
viewHolder.title.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-M.ttf"));
viewHolder.text.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-L.ttf"));
viewHolder.author.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-N.ttf"));
viewHolder.addition.setTypeface(Typeface.createFromAsset
(context.getAssets(), "Ubuntu-N.ttf"));
viewHolder.text.setTextSize(Integer.parseInt(sharedPref.getString("size_preview", "15")));
viewHolder.pos = position;
v.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) v.getTag();
}
viewHolder.text_group.setText(themetext(data.get(position).get(NAMEGROUP).toString()));
viewHolder.text_date.setText(data.get(position).get(DATE).toString());
viewHolder.title.setText(data.get(position).get(HEADER).toString());
viewHolder.text.setText(ExtraClass.text_clear(data.get(position).get(CONTENT).toString()));
viewHolder.author.setText(data.get(position).get(AUTHOR).toString());
ExtraClass.setIco(data.get(position).get(NAMEGROUP).toString(), viewHolder.ico_group, context);
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(context));
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheOnDisk(true)
.cacheInMemory(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
//.showStubImage(R.drawable.notif)
.build();
imageLoader.displayImage(data.get(position).get(IMG).toString(), viewHolder.img, options);
return v;
所有外观,图像不加载只大。我该如何解决这个问题?
答案 0 :(得分:0)
如果图像来自服务器,则尝试在asyncTask OnPost()
中设置适配器