gpt4 book ai didi

android - 用于填充和边距的单位

转载 作者:行者123 更新时间:2023-11-30 01:50:41 24 4
gpt4 key购买 nike

我想在我的应用程序中处理多屏幕处理。

我看到在教程中边距和填充是在 dp 中设置的。

我想知道 dp 是否是 padding 和 margin 的最佳单位?还有哪些其他单位可用于设置填充和边距?

最佳答案

在我看来,使用 dp 是边距和填充的最佳选择。

The units available are :

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

sp Scale-independent Pixels - this is like the dp unit, but it is alsoscaled by the user's font size preference. It is recommend you usethis unit when specifying font sizes, so they will be adjusted forboth the screen density and user's preference.

mm Millimeters - based on the physical size of the screen.

关于android - 用于填充和边距的单位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33095398/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com