简体   繁体   English

Tablelayout与海量数据android

[英]Tablelayout with massive data android

What is the best way to create a table layout or recyclerview/listview/gridview in android that can pull a lot of data around 1000 rows and around 50 columns each row without to crash ? 在android中创建表格布局或recyclerview / listview / gridview的最佳方法是什么,可以在每行大约1000行和大约50列中提取大量数据而不会崩溃?

I want to show it like excel sheet nothing special just show data of course with scrolling both ways. 我想像excel表一样展示它没什么特别的,只是显示数据当然滚动两种方式。

TableFixHeaders project on github has an implementation with both Adapter an Recycling of views, plus handles scrolling wery nicely. github上的TableFixHeaders项目有一个实现,包括AdapterRecycling of views,以及很好地滚动的句柄。 And is quite easy to modify to suit your needs. 并且很容易修改以满足您的需求。

在此输入图像描述

This is not so uncommon request, so it has been done numerous times. 这不是那么罕见的要求,所以它已经做了很多次。 I am sure you can find other implementations if this one is not right for you. 我相信如果这个不适合您,您可以找到其他实施方案。

I saw a similar question on SO a few months ago, and I was interested to see if I could develop a solution. 几个月前我在SO上看到了一个类似的问题,我很想知道我是否可以开发一个解决方案。

My concept was to start with a ListView for vertical scrolling and view recycling. 我的概念是从ListView开始,用于垂直滚动和视图回收。 Each list item is a HorizontalScrollView to show a table row with many columns. 每个列表项都是一个HorizontalScrollView用于显示包含许多列的表行。 The trick here is to listen to each HorizontalScrollView for swipe events and then scroll every HorizontalScrollView in sync with the view being swiped. 这里的技巧是监听每个HorizontalScrollView的滑动事件,然后滚动每个 HorizontalScrollView与正在滑动的视图同步。

I have a proof-of-concept project on Github here: klarson2/android-table-test 我在Github上有一个概念验证项目: klarson2 / android-table-test

Downsides: The project was set up for Eclipse, so you can't open it directly with Android Studio. 缺点:该项目是为Eclipse设置的,因此您无法使用Android Studio直接打开它。 There is still a small bug with event handling that I haven't got around to fixing. 事件处理仍然存在一个我无法解决的小错误。 Another limitation is that each cell view in the horizontal LinearLayout must be a fixed size so that the columns will line up correctly. 另一个限制是水平LinearLayout中的每个单元格视图必须是固定大小,以便列正确排列。

However, the example uses a 4MB .csv file with 50 columns and over 10,000 rows for a data source proving that it is possible to display an enormous table in an Android app with responsive two-way scrolling. 但是,该示例使用一个包含50列和超过10,000行的4MB .csv文件作为数据源,证明可以在Android应用程序中显示响应性双向滚动的巨大表格。

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

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