0

众所周知,如果我们将一个96x96 像素的图像放在项目文件夹xxhdpi中,它将显示在32dp.

现在我有一个96x96 像素的图像文件,它位于存储中。我从该图像创建一个BitmapDrawable对象。我想要的是:图像应该显示在32dp.

这是我尝试过的:

BitmapDrawable bmd = (BitmapDrawable)BitmapDrawable.createFromPath(localFile.getAbsolutePath());
bmd.setTargetDensity(DENSITY_XXHIGH);

但它不起作用。它看起来比32dp. 谁能告诉我怎么做?

4

0 回答 0