DroidFu - 缩放/拉伸 WebImageView

发布于 2024-12-18 18:33:41 字数 1421 浏览 0 评论 0原文

我收集了通过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

留一抹残留的笑 2024-12-25 18:33:41

检查 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文