我找不到任何比较两者性能的内容。使用 ConstraintLayout 模仿 TableLayout 会比单独使用 TableLayout 表现更好吗?
最佳答案
由于 TableLayout
和 TableRow
均从 LinearLayout
扩展,因此将它们与 ConstraintLayout
进行比较将是相同的将两个嵌套的 LinearLayout
与一个 ConstraintLayout
进行比较。
Android documentation和 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.
关于android - TableLayout 与 ConstraintLayout 性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56469924/