首页 > 解决方案 > DataGrid Android Studio 水平垂直滚动

问题描述

我正在寻找可以通过水平和垂直滚动显示大数据的解决方案。像这样的https://www.syncfusion.com/blogs/post/new-datagrid-for-xamarinios-and-xamarinandroid.aspx。我想更改列数并更改单元格值。

请问你有这样的吗?当它是免费的时候,我会很高兴。谢谢

标签: androidandroid-studiodatagrid

解决方案


您可以通过自定义创建它TableLayout。好消息是您可以在TableLayout. 你必须先设置一个TableLayoutxml。对于两侧滚动,您必须先添加,ScrollView然后HorizontalScrlollView再添加TableLayout.

现在您可以创建rowcolumn。您可以动态创建它,因为您(可能)不知道需要多少列。因此,您必须创建自定义 TableRow 和单元格,并且您可以轻松地添加您的tableLayout.

TableRow row= new TableRow(this);
        TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
        row.setLayoutParams(lp);
// then create your text view and add it row. and last add row in your table layout

这只是一个例子。您可以创建自己的数据网格库

您可以使用一些现成的配合库在表格视图中显示数据网格,就像您的参考一样。:

https://github.com/evrencoskun/TableView https://github.com/ISchwarz23/SortableTableView


推荐阅读