Alright i've spent several hours try to figure this out and most solutions didn't work, the one that did work made the height and width ratio of the image stay the same, what i want is to be able to set the imageview image from a URL and make the width match_parent and the height 175dp. PLEASE SOMEONE HELP ME!!!
Asked
Active
Viewed 167 times
0
-
http://stackoverflow.com/questions/17120230/android-set-imageview-to-url/17120523#17120523. check this might help – Raghunandan Jun 22 '13 at 18:14
1 Answers
0
use following code
<ImageView android:layout_width="match_parent"
android:layout_height="175dp"
android:scaleType="fitXY"
/>
public static void LoadImageFromWebOperations(String url,ImageView img) {
try {
InputStream is = (InputStream) new URL(url).getContent();
Drawable d = Drawable.createFromStream(is, "src name");
img.setImageDrawable(d);
} catch (Exception e) {
}
}