【发布时间】:2012-03-01 09:19:46
【问题描述】:
我正在编写一个安卓应用程序。我正在从服务器下载图像并尝试使用 setBackgroundDrawable 将其设置为 ImageView 背景。
Drawable drawable = Drawable.createFromPath(path)
imageView.setBackgroundDrawable(drawable);
它可以工作,但图像被调整大小(它越来越小)。有谁知道如何在不改变其大小的情况下设置图像视图背景?
编辑: 我通过使用解决了这个问题:
File imgFile = new File(path);
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
imageView.setImageBitmap(myBitmap);
【问题讨论】:
标签: android imageview drawable