最好的 LinearLayout、RelativeLayout 和最新的 ConstraintLayout
Best of LinearLayout, RelativeLayout and of latest ConstraintLayout
我对此有很多疑问。我很擅长使用 LinearLayout、RelativeLayout 或 ConstraintLayout,想知道最好。 如果有人有理由使用其中之一。
一些问题:
- 我认为 LinearLayout 将添加一个节点层次结构,这将比 RelativeLayout 或 ContraintLayout 花费更多的时间来渲染,对吗?
- 为什么 android 正在考虑
ContraintLayout
使用多于 RelativeLayout
和 LinearLayout
?即使我可以在 LinearLayout
或 RelativeLayout
中进行相同的布局
I think LinearLayout will add a hierarchy of nodes which will take more time to render than RelativeLayout or ContraintLayout, is it right?
嵌套的LinearLayout
小部件可以 呈现得更慢。不能保证它 会 呈现得更慢。使用嵌套权重是获得一组缓慢的嵌套 LinearLayout
小部件的一种已知方法。
Why android is considering ContraintLayout to use more than RelativeLayout and LinearLayout?
ConstraintLayout
比 LinearLayout
和 RelativeLayout
处理更多的场景。 ConstraintLayout
比 RelativeLayout
.
更容易通过 drag-and-drop 支持 IDE
Even i can make same layout in LinearLayout or RelativeLayout
有多种情况在LinearLayout
或RelativeLayout
中难以实现,但ConstraintLayout
却可以轻松应对,例如:
循环定位
ConstraintLayout
本身的最小和最大大小(帮助 wrap_content
变得太小或太大)
child保持特定的宽高比
实现一些链的变体
锚定children到人工rules-based行,例如Guideline
和Barrier
我对此有很多疑问。我很擅长使用 LinearLayout、RelativeLayout 或 ConstraintLayout,想知道最好。 如果有人有理由使用其中之一。
一些问题:
- 我认为 LinearLayout 将添加一个节点层次结构,这将比 RelativeLayout 或 ContraintLayout 花费更多的时间来渲染,对吗?
- 为什么 android 正在考虑
ContraintLayout
使用多于RelativeLayout
和LinearLayout
?即使我可以在LinearLayout
或RelativeLayout
中进行相同的布局
I think LinearLayout will add a hierarchy of nodes which will take more time to render than RelativeLayout or ContraintLayout, is it right?
嵌套的LinearLayout
小部件可以 呈现得更慢。不能保证它 会 呈现得更慢。使用嵌套权重是获得一组缓慢的嵌套 LinearLayout
小部件的一种已知方法。
Why android is considering ContraintLayout to use more than RelativeLayout and LinearLayout?
ConstraintLayout
比 LinearLayout
和 RelativeLayout
处理更多的场景。 ConstraintLayout
比 RelativeLayout
.
Even i can make same layout in LinearLayout or RelativeLayout
有多种情况在LinearLayout
或RelativeLayout
中难以实现,但ConstraintLayout
却可以轻松应对,例如:
循环定位
ConstraintLayout
本身的最小和最大大小(帮助wrap_content
变得太小或太大)child保持特定的宽高比
实现一些链的变体
锚定children到人工rules-based行,例如
Guideline
和Barrier