【发布时间】:2016-12-21 20:52:49
【问题描述】:
我的列表视图项目由三列和三行组成。我使用了TableLayout。列之间的空间不均匀,但我通过设置边距来管理。现在布局看起来很完美。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/dp18"
android:paddingLeft="@dimen/dp16"
android:paddingTop="@dimen/dp18"
android:stretchColumns="0,1,2">
<TableRow>
..
</TableRow>
<TableRow>
..
</TableRow>
<TableRow>
..
</TableRow>
</TableLayout>
但我想知道理想的方法是什么?如果我使用了四个线性布局(一个外部水平线性布局和三个用于三列的内部垂直线性布局),那么在优化和性能方面会有什么不同。由于 TableRow 扩展了 LinearLayout,然后我间接地使用了 LinearLayout。
那么,使用单个 TableLayout 而不是多个 LinearLayout 的优势是什么,因为 TableRow 只扩展了 LinearLayout?
【问题讨论】:
-
你考虑过 RecyclerView 吗?我认为它会给你最大的灵活性和最好的性能,特别是如果你有很长的清单。
-
@Shaishav 我只是在等待更多的答案或 cmets.. 无论如何我会接受它..
-
@Vladmir Jovanovic 是的,现在我只使用 recyclerview..
标签: android android-layout android-linearlayout tablelayout