0

我对“ dp ”的使用有疑问。
在哪种情况下可以使用 dp?它只是用于任何控件,即 ImageView 和 TextView,还是也可以用于调整布局。
为了调整布局,我目前正在根据屏幕宽度和高度的百分比来指定控件的宽度和高度。

4

2 回答 2

0

它可以用作指定宽度和高度的单位。您可以将它与所有视图一起使用...查看更多信息...

于 2012-04-17T06:43:47.160 回答
0

dp

Density-independent Pixels - an abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. Note: The compiler accepts both "dip" and "dp",

使用 dip 或 dp 是为了让你的 Android 应用程序兼容多种屏幕密度和分辨率。

于 2012-04-17T06:46:20.170 回答