gpt4 book ai didi

mobile - 如何将Android的DP转为Flutter的LP? DP和LP有什么区别?

转载 作者:IT王子 更新时间:2023-10-29 06:53:42 26 4
gpt4 key购买 nike

我得到了一个新应用的设计。所有尺寸均适用于 Android,并以 DP -(密度无关像素)给出。我如何将这些值转换为 Flutter 的 LP(逻辑像素)。我知道 Window.devicePixelRatio 为我提供了每个逻辑像素的设备像素数。

DP 和 LP 之间的确切区别是什么?dp 到 lp 转换是否有任何内置方法?

最佳答案

根据文档(window.devicePixelRatioFlutter for Android Developers),DP 和 LP 之间没有区别。

Device pixels are also referred to as physical pixels. Logical pixels are also referred to as device-independent or resolution-independent pixels.

Flutter doesn’t have dps but there are logical pixels, which are basically the same as device-independent pixels. The so-called devicePixelRatio expresses the ratio of physical pixels in a single logical pixel.

关于mobile - 如何将Android的DP转为Flutter的LP? DP和LP有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55032853/

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