0

I am sure this exists, but for some reason I am either not searching for the right terminology, or Google-Fu is failing me.

In one layout, I have a grid of information:

example grid

Ignoring the horrid colors for now, I want to use this in conjunction with an expandable cardview, where, say, only the first three rows (Status, Satellite, Color) are displayed, and then if tapped on, the rest of them open up and become shown. (Tap again, and it bounces back down to the top three.)

In all the expandable controls out there, they all expect a 'header' and a 'content', where when collapsed, only the 'header' is shown. While that IS an option, I would prefer not to use it since then there would be two separate grid controls whose columns would not match up.

I could overcome the columns not lining up by adding code during the onCreateView to measure all the textviews in both columns, get the widest, and apply that to all. But that seems like a bigger pain, and not very usable in case things need to change in the future.

I thought about using a plain CardView, and forcing a height on it, clipping anything outside of the card's layout, but since the data in the rows can alter, I would need to measure it each time before performing the collapse/expand.

I thought about hiding the excess rows - however, as far as I can see, there's no easy way to access an entire row and set its height to '0dp'. Also since some rows need to STAY hidden - for example, if the data point the user is looking at does not HAVE a 'Setting', the label textview and the value textview are both hidden. (Again, since you can't seem to hide specific rows.)

Is there a control - or set of controls - that would allow me to 'expand a grid' like I am looking for, or do I need to set a fixed width for my labels and split a grid in half?

Coyttl
  • 515
  • 1
  • 4
  • 18
  • https://stackoverflow.com/questions/32011995/how-to-have-a-listview-recyclerview-inside-a-parent-recyclerview/32086918#32086918 – Zain Aug 08 '21 at 19:40

0 Answers0