Sunday 15 August 2010

android - Set imageview image from a url -


OK I've spent several hours try to understand it and most of the solutions do not work, which worked the image Height and width ratio remain the same, what do I want to set image view image from URL and be able to create width match_perrent and altitude 175dp

Use the following code

  & lt; Android: Image Android: layout_width = "match_perrent" Android: layout_hett = "175dp" Android: scaleType = "fitXY" /> Public Static Zero LoadImageFromWebOperations (string url, ImageView img) {try {InputStream = (InputStream) is the new URL (url) .getContent (); Drawable d = Drawable.createFromStream (is, "src name"); Img.setImageDrawable (d); } Hold (exception e) {}}    

No comments:

Post a Comment