来自互联网的图片比在android中的图片要小

时间:2012-11-03 18:21:06

标签: android url inputstream

我想从互联网上加载图标。我是这样做的:

Drawable drawable = null;
                try {
                    InputStream is = (InputStream) new URL(xml.getBIcon())
                            .getContent();
                    Drawable d = Drawable.createFromStream(is, "src name");

                    drawable = d;

                } catch (Exception e) {
                    System.out.println("Exc=" + e);
                }

final AlertDialog alertDialog = new AlertDialog.Builder(
                        context).create();
                alertDialog.setTitle(title);
                alertDialog.setMessage(text);
                alertDialog.setButton("Install",
                        new DialogInterface.OnClickListener() {

                            public void onClick(DialogInterface dialog,
                                    int which) {
                                String url = link;
                                Intent i = new Intent(Intent.ACTION_VIEW);
                                i.setData(Uri.parse(url));
                                context.startActivity(i);
                            }
                        });


                alertDialog.setIcon(drawable);

                alertDialog.show();
            }

不幸的是,图标比它应该低两倍。当它在res文件夹中时,它的大小正确。这是什么原因?

0 个答案:

没有答案