开发者

Does element preserve its position regardless of screen size?

开发者 https://www.devze.com 2023-03-27 06:13 出处:网络
Let\'s say I h开发者_C百科ave a background with red circle in it, and I want to position 2 buttons like on the image.

Let's say I h开发者_C百科ave a background with red circle in it, and I want to position 2 buttons like on the image.

Does element preserve its position regardless of screen size?

I am doing position on 160dpi HVGA screen resolution (480x320) emulator.

Will these element remain its position on all screens? They are positioned one above another in 2 RelativeViews inside LayoutView container.

As documentation says that width/height is caclucated based on 160dpi screen, I came to conclusion that this is the way to achieve this. If I am wrong, what is the right way.


The best way to accomplish what you are asking (I think) is to ensure you have graphics for all of the different screen dpis.

You can do this by creating folders

drawable
drawable-ldpi
drawable-mdpi
drawable-hdpi

in your /res folder.

This lets you use specific resources for different dpis, and guarantees the view will look right (after testing) for any screen density.

I suggest looking over the Android documentation for supporting different screens types and the taking a look at this section in particular.

Hope this helps!

0

精彩评论

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

关注公众号