阅读Android开发人员指南的Supporting Multiple Screens,它表示最好使用密度无关像素(dp)而不是像素,并且还表示Android处理大多数应用程序在不同密度设备上的渲染。什么单位传递UI方法?
现在的问题是,如果我们看一下View类的填充功能
setPadding(INT左,INT顶部,诠释 权,INT底部)
left the left padding in pixels
top the top padding in pixels
right the right padding in pixels
bottom the bottom padding in pixels
当我使用这个函数时,可以传递直接值,还是必须通过从dp到px的转换值才能最好地显示所有设备中的UI?
谢谢。我也是这么想。实际上,我只检查了setPadding函数的描述,并错过了阅读doc中的android:padding描述。通过它的描述,似乎我们必须将dp转换为setPadding函数的像素。 – poddroid 2011-04-12 19:52:25