开发者

Downloading and displaying an image in a DPI independent way

In my app, I have a logo. At first, I used an image that I put in the Drawables folder (in three different sizes).

Now I download it as a string from a web service, converting it to a drawable and displaying it. I've put the image in it's three different sizes on the web service and I've created a function on the service that returns the image in one of the three sizes depending on the downloading unit's DPI.

It doesn't real开发者_如何学Cly work as expected, though, since the actual size of the images varies greatly between a low DPI and high DPI unit (I'm using an emulator and an actual phone, respectively). My goal is to download the image and then display it in an DPI independent fashion, so the actual size is the same on all screen sizes, as were the case in the beginning.


The problem was easily solved using the setTargetDensity(int density) method in the BitmapDrawable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜