We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App 架构为单Activity 多Fragment + Compose 架构, 原生View 有缩放效果,Compose 没有,
2023-12-11 20:26:06.382 12929-12929 FragmentMain tech.. I SearchView displayMetrics = DisplayMetrics{density=1.3333334, width=2560, height=1600, scaledDensity=1.3333334, xdpi=239.058, ydpi=239.058, densityDpi=213, noncompatWidthPixels=2560, noncompatHeightPixels=1600, noncompatDensity=2.0, noncompatDensityDpi=320, noncompatXdpi=239.058, noncompatYdpi=239.058} 2023-12-11 20:26:06.382 12929-12929 FragmentMain tech.. I SearchView displayMetrics = DensityImpl(density=2.0, fontScale=1.0) 2023-12-11 20:26:06.560 12929-12929 FragmentMain tech.. I SearchView 627.dp = 836.0 2023-12-11 20:26:06.560 12929-12929 FragmentMain tech.. I SearchView 627.dp = 836.0
Compose 在Layout 的时候 dp转 px的时候 使用的是 Density 2 fun Dp.toPx(): Float = value * density 方法。
但是 从日志中可以看到 Compose 的DensityImpl 的density 始终是2.0 没有被修改。
@Stable fun Dp.toPx(): Float = value * density /** * Convert [Dp] to [Int] by rounding */ @Stable fun Dp.roundToPx(): Int { val px = toPx() return if (px.isInfinite()) Constraints.Infinity else px.roundToInt() }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
Bug Description:
App 架构为单Activity 多Fragment + Compose 架构,
原生View 有缩放效果,Compose 没有,
Log:
Compose 在Layout 的时候 dp转 px的时候 使用的是
Density 2
fun Dp.toPx(): Float = value * density
方法。
但是 从日志中可以看到 Compose 的DensityImpl 的density 始终是2.0 没有被修改。
Related Code:
Others:
The text was updated successfully, but these errors were encountered: