0

In Android Studio, I am building a static table in a Resource Layout file with 10 columns (each column has different widths) and 30 rows. The data in the table will be filled dynamically, programmatically. Being a newbie, I've read up on Constraint Layout and Table Layout (and a bit on Grid Layout).

Here's an image of what I'm trying to build: https://i.stack.imgur.com/MdXbn.png

Because there is 300 data cells, with shading and a variety of borders, which Layout option would be best/simplest to implement? I don't think performance is an issue because of the flat nature of the layout? I don't think a Table Layout easily supports child element styles and a Constraint Layout file with 300 TextViews and a lot of constraints would be quite large and complex.

David Joyce
  • 51
  • 1
  • 5
  • Using `ConstraintLayout` programmatically is considerably harder than on any other layout – cmak Jan 14 '22 at 00:36
  • I wasnt planning on building the table programmatically- just going to fill the TextViews with code. The table is static so which layout is best? – David Joyce Jan 14 '22 at 02:54
  • You'll probably want to build it programmatically, 300 cells is a lot to manage manually. `GridLayout` will be better than a `TableLayout`, since it handles rows and columns better. See here how to: https://stackoverflow.com/a/35693072/11880323 Performance won't be a problem since it's just text and colors – cmak Jan 19 '22 at 19:47
  • Thx. I ended up using your suggestion- built a series of .setText(Html.fromHtml() code which worked well for my needs. – David Joyce Feb 17 '22 at 02:42

0 Answers0