TableLayout 与 ConstraintLayout 性能

TableLayout vs ConstraintLayout Performance

我找不到任何东西来比较两者的性能。模仿带有 ConstraintLayout 的 TableLayout 会比单独使用 TableLayout 表现更好吗?

因为 TableLayoutTableRow 都是从 LinearLayout 扩展而来的,将它们与 ConstraintLayout 进行比较与将两个嵌套的 LinearLayout 与一个进行比较是一样的ConstraintLayout.

Android documentation and this Android developers article 描述了 ConstraintLayout 相对于其他 ViewGroup 类型的优势。

ConstraintLayout 将优于嵌套 LinearLayout 特别是如果它们 have defined weights,因为它在 TableLayout.

中很常见

Layout weights require a widget to be measured twice. When a LinearLayout with non-zero weights is nested inside another LinearLayout with non-zero weights, then the number of measurements increase exponentially.