简体   繁体   English

用于TableLayout的Android数据绑定

[英]Android data binding for TableLayout

I am reading this manual https://developer.android.com/topic/libraries/data-binding/index.html and it is not clear for me, how to fill the TableLayout with rows if my data is kept in ObservableArrayList? 我正在阅读本手册https://developer.android.com/topic/libraries/data-binding/index.html ,对我来说还不清楚,如果我的数据保存在ObservableArrayList中,如何用行填充TableLayout? All examples assume there to show a single record, but I want to show all records in the table. 所有示例都假定在那里显示单个记录,但是我想显示表中的所有记录。
Or may be it is impossible and I should use RecyclerView instead? 还是有可能是不可能的,我应该改用RecyclerView?

You might find this article helpful: 您可能会发现这篇文章很有帮助:

https://medium.com/google-developers/android-data-binding-list-tricks-ef3d5630555e#.c1vesyobm https://medium.com/google-developers/android-data-binding-list-tricks-ef3d5630555e#.c1vesyobm

It discusses how to turn lists in to Views in a ViewGroup. 它讨论了如何将列表转换为ViewGroup中的View。 When you make it work for TableView, you might want to publish it here for people to use. 当使它适用于TableView时,您可能希望在此处发布它以供人们使用。

That said, if you have only a few Views, you can use data binding. 就是说,如果只有几个View,则可以使用数据绑定。 If you're planning on having a scrolling list, you should use RecyclerView. 如果您打算使用滚动列表,则应使用RecyclerView。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM