DroidFu - 缩放/拉伸WebImageView

时间:2011-11-30 22:41:43

标签: android droid-fu

我收集了65x65像素的源图像,我正在通过DroidFu检索。我想以80x80dip呈现它们以更好地适应我的listView行内容。

鉴于我不想在源(服务器)上调整大小来扩展droidfu WebImageView的好方法?

@Override
public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            v = mInflater.inflate(R.layout.my_feed_item_row, null);
        }
        MyFeedItem o = items.get(position);
        if (o != null) {
                TextView line1 = (TextView) v.findViewById(R.id.line1);
                TextView line2 = (TextView) v.findViewById(R.id.line2);
                TextView line3 = (TextView) v.findViewById(R.id.line3);
                TextView line4 = (TextView) v.findViewById(R.id.line4);
                if (line1 != null) {
                      line1.setText(o.getLine1());                            }
                if(line2 != null){
                      line2.setText(o.getLine2());
                }
                if(line3 != null){
                    line3.setText(o.getLine3());
                }
                if(line4 != null){
                    line4.setText(o.getLine4());
                }

                WebImageView rowThumbnail = (WebImageView);
                v.findViewById(R.id.feed_row_thumbnail);
                rowThumbnail.setImageUrl(o.getIconURLString());
                rowThumbnail.loadImage();
        }
        return v;
    }

}

1 个答案:

答案 0 :(得分:1)

在webimageview的代码中检查,布局参数已设置为包装内容。更改它以填充父级

并将Scaletype更改为适合xy