开发者

Displaying Image at different sizes

From my understanding of the Android support for multiple screens 开发者_如何学JAVASupport, layouts are scaled for screen density and size, whereas images are scaled for screen density.

This ensures that images will appear the same size on different density screens. To overcome possible scaling issues, it is recommended to provide different versions of the images with following the 3:4:6:8 scaling ratio between the four generalized densities.

However, if I have a screen that is simply to display a photo with some text underneath, and I want to take advantage of the extra screen size in some mobiles, and therefore display the photo at a larger size from the user's point of view than on the smaller screens, then what is the best way of doing this?

Also wrt displaying images, is it best to use wrap_content or dp – what is the advantage of one over the other ?

Thanks very much in advance

P


In answer to your first question: You probably need to specify a different drawable resource for every image you're going to do. Here is a link to the android developer's site that specifies methods of doing that. http://developer.android.com/guide/practices/screens_support.html

Second: If you specify the dp, you may cause some image distortion, however, if you use wrap_content, it may not be big enough. I would suggest for you to use wrap_content with different drawables for each screen density.

EDIT:

To find the actual size: Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight();

You're going to have to calculate it though based on the screen density.

And then just use mm or inches

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜