如何在Android中实现“数据表"(材料设计组件)? [英] How to Implement 'Data Tables' (material design component) in android?

查看:89
本文介绍了如何在Android中实现“数据表"(材料设计组件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了这个新的设计规范

I have gone through this new design specifications

https://www.google. com/design/spec/components/data-tables.html#data-tables-interaction

我们如何在android中实现所有这些结构,交互.我找不到足够的文档来描述此实现.这仅是一种设计语言规范.有任何有用的文件吗?谢谢

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

官方文件说:数据表通常出现在台式机企业产品中."但是我对实现感到好奇.在移动设备/平板电脑中将如此多的数据显示为表格不是一个好习惯吗?

推荐答案

TL; DR :我强烈建议您寻找一个不同的UI元素来表示您的应用程序中的数据,但是如果您觉得正确以表格格式显示数据,请使用 v7支持库GridLayout .

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.

我们如何在android中实现所有这些结构,交互.一世 找不到足够的文档来描述此实现.这是 仅是设计语言规范.有任何有用的文件吗?谢谢

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

要实现此数据表设计,您肯定会想使用此StackOverflow答案.逻辑可能稍有不同,因为我链接到的答案告诉您如何显示GridView而不是GridLayout的网格项分隔符,但是应该应用相同的逻辑.只需为GridLayout提供背景颜色,为GridLayout子级提供不同背景颜色,然后指定每个项目之间所需的间距.在您的情况下,所需的垂直间距将为0dp,水平间距将为1dp.这样,您GridLayout中的背景将显示"给用户,从而产生分隔效果.

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.

这篇关于如何在Android中实现“数据表"(材料设计组件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆