我尝试使用jsoup库下载图像并将其设置为图像视图,但下载的图像会自动裁剪。我不知道它是图书馆还是别的什么。这是我的代码,有人帮我吗?
try {
// Connect to the web site
Document documentImage1 = Jsoup.connect(url).get();
// Using Elements to get the class data
Element img = documentImage1.select("div[class=media-img imgflare--river] img[src]").first();
// Locate the src attribute
String imgSrcImage1 = img.attr("src");
// Download image from URL
InputStream inputImage1 = new java.net.URL(imgSrcImage1).openStream();
// Decode Bitmap
image1 = BitmapFactory.decodeStream(inputImage1);
} catch (IOException e) {
e.printStackTrace();
}