DroidFu - 缩放/拉伸 WebImageView
我收集了通过 DroidFu 检索的 65x65 像素源图像。我想以 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;
}
}
I have collection of 65x65 pixel source image I'm retrieving via DroidFu. I want to present them at 80x80dip to better fit my listView row contents.
Given that I do not want to resize at the source (server) what would be a good approach to scale a 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;
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查 webimageview 的代码,布局参数已设置为换行内容。将其更改为填充父级
,并更改 Scaletype 以适合 xy
check inside the code for webimageview , the layout params have been set to wrap content .Change it to fill parent
and also change Scaletype to fit xy