gpt4 book ai didi

android - android studio SDK工具中 "ConstraintLayout for android"和 "Solver for ConstraintLayout"的区别

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:48:48 24 4
gpt4 key购买 nike

在android studio SDK工具中有两个ConstraintLayout选项,一个是ConstraintLayout for android,另一个是Solver for ConstraintLayout

截图如下: enter image description here

这两个选项有什么区别?

最佳答案

求解器的作用。

为了将约束转化为实际位置和大小,约束求解器应用 Cassowary 算法来找到解决方案。看看这篇文章,了解这种布局的工作原理以及为什么包中有解算器。 https://www.bignerdranch.com/blog/constraintlayout-vs-auto-layout-how-do-they-compare/

约束布局到底是什么?

如 android 所述 “一个布局,其中子级的位置被描述为相对于彼此或父级的约束。”

https://android.googlesource.com/platform/frameworks/opt/sherpa/+/gradle_2.0.0/constraintlayout/src/main/java/android/support/constraint/ConstraintLayout.java

Constraint Layout is equations describing positional relation between views and Solver solves those equations to help android determine positions (x,y,z, length, width) where views should be drawn.

关于android - android studio SDK工具中 "ConstraintLayout for android"和 "Solver for ConstraintLayout"的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43366746/

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