0
在url後面有一個高度爲80,寬度爲120px的圖像。因此,讓我取,Android中縮小圖像的奧祕
private InputStream fetch(String url) throws MalformedURLException, IOException
{
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = httpClient.execute(request);
return response.getEntity().getContent();
}
我得到我想要的InputStream和繪製:
InputStream is = fetch(url);
Drawable drawable = Drawable.createFromStream(is, "");
int height = drawable.getIntrinsicHeight();
int width = drawable.getIntrinsicWidth();
突然我的形象是80x53像素。任何人都可以解釋爲什麼會發生這種情況,以及如何說服我的應用程序保持圖像的原始大小?