Android的多屏幕支持 [英] Android multiple screen support
问题描述
我感到困惑Android的多屏幕支持。 http://developer.android.com/guide/practices/screens_support.html 我读了这篇文章,但仍然事情不清楚我。
I am confused about android's multiple screen support. http://developer.android.com/guide/practices/screens_support.html I read this article, but still something is not clear for me.
- 我用DP代替PX在我的布局
- 我把高,中,图像以绘制资源目录的低版本的。
我在依照本条这改变。但在一些密度下,仍然存在问题,尽管其中一些工作得很好。
I made this changes according to this article. But in some densities, there is still problem although some of them work very well.
问题是,什么是多款Android的屏幕类型的确切宽度和高度dp为单位。如果是多变,PX之间的区别是什么呢?
The question is what is the exact width and height in dp units for variety of android screen types. if it is changeable, what is the difference between px?
- PX多变,DP多变太?有什么区别?
如果改变能改变的,我应该更改视图对每个屏幕dentisies创建功能或创建单独的布局,宽度和高度由code?请给一个方式来理解这个...
if changeable, should I change the view's width and height by code on Create function or create seperate layouts for each screen dentisies? Please give a way to understand this...
在此先感谢..
推荐答案
PX是一个固定的措施。这意味着,如果100像素的小屏幕上占据屏幕的1/2,它会占用大屏幕上要少得多。 DP =密度(独立的)的像素,基于该装置的densitity。所以,如果你指定一个宽度50dp在小屏幕上,这将扩大在大屏幕上。需要注意的是DP是不是在所有设备上的布局保持兼容的保险,因为设备具有不同的纵横比。要构建一个完美的布局,看起来一模一样上的所有设备,必须使用更多的技术。 LinearLayout中,您可以分配权重。考虑这样做。 http://developerlife.com/tutorials/?p=312
px is a fixed measure. This means that if 100px on a small screen take up 1/2 of the screen, it will take up much less on a large screen. dp = density (independent) pixels, is based on the densitity of the device. So if you specify a width to 50dp on a small screen, it will expand on a large screen. Note that dp is not an insurance of layout compability on all devices, since devices have different aspect ratios. To build a perfect layout, that looks exactly the same on all devices, you must use more techniques. Linearlayout allows you to assign weights. Look into that. http://developerlife.com/tutorials/?p=312
这篇关于Android的多屏幕支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!