【发布时间】:2011-08-04 04:17:17
【问题描述】:
阅读 Android 开发者指南的 Supporting Multiple Screens,它说最好使用与密度无关的像素 (dp) 而不是像素,它还说 Android 可以处理不同密度设备上的大部分应用程序渲染。
现在我的问题是,如果我们看一下 View 类的填充函数
setPadding (int left, int top, 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?
【问题讨论】:
标签: android