How to Implement 'Data Tables' (material design component) in android?

一笑奈何 提交于 2019-12-01 02:28:18
lustig

TL;DR: I would highly recommend looking into a different UI element to represent this data in your application, but if you feel it is correct to display the data in a table format, use the v7 Support Library GridLayout.

How can we implement all these Structure, Interactions in android. I haven't found enough documents describing this implementation. Is this only a design language specification. Any helpful documents? Thanks

To implement this Data Table design, you would most certainly want to use a GridLayout from the v7 support library. To achieve the colored dividers in your Table Layout, see this StackOverflow answer. The logic may be slightly different, as that answer I've linked to tells you how to display the grid item dividers for a GridView rather than a GridLayout, but the same logic should apply. Simply give a background color to your GridLayout, a different background color to your GridLayout children, and then designate the spacing you need between each item. In your case, the vertical spacing you want will be 0dp, and the horizontal spacing will be 1dp. That way, the background from your GridLayout will "show through" to the user, creating a divider effect.

The official document says that "Data tables usually appear in desktop enterprise products." But I am curious about the implementation. Is it not a good practice to show this much data as table in mobile/Tablet?

As always, the answer depends. However, think about it this way: when was the last time you saw a table displayed on a mobile device? To be honest, I can't quite think of one. Perhaps you may want to talk with your design team (or consider yourself if you're an indie developer) whether or not a data table is the best design choice for this particular use-case. Perhaps a graph would be a more digestible way of displaying the data. Perhaps a few different lists of each column separated by selection via a Spinner.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!