大家好,大家好, 任何人都可以建议我如何使用设备独立像素(dip),sip 并使用示例代码将 px 转换为 dip..
最佳答案
看看这个。
Density-independent pixel (dip)
A virtual pixel unit that applications can use in defining their UI, to express layout dimensions or position in a density-independent way.
The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, the baseline density assumed by the platform (as described later in this document). At run time, the platform transparently handles any scaling of the dip units needed, based on the actual density of the screen in use. The conversion of dip units to screen pixels is simple: pixels = dips * (density / 160). For example, on 240 dpi screen, 1 dip would equal 1.5 physical pixels. Using dip units to define your application's UI is highly recommended, as a way of ensuring proper display of your UI on different screens.
关于java - 如何在android中使用dip和sip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4232352/