2

我想从 Internet 加载图标。我这样做:

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 文件夹中时,它的大小正确。这是什么原因?

4

0 回答 0