如何创建一台S preadSheet一种显示在Android的?一台、preadSheet、Android

2023-09-04 06:46:58 作者:那道傷〃還在隱隱作痛

我想展示一台S preadSheet在Android应用程序auot可调列和每一列应包围lines.I使用的表布局中的数据显示在表格式,但我不知道如何包围用线每列,自动adjustment.If任何人都知道这一点,请帮助我。

I am trying to display a SpreadSheet in the Android application with auot adjustable columns and each columns should surrounded by lines.I used the Table Layout the data are displayed in the Table format but i dont know how to surround each column with lines, auto adjustment.If anyone knows it please help me.

推荐答案

使用的 TableLayout.LayoutParams 或 TableRow.LayoutParams 。他们继承 ViewGroup.MarginLayoutParams ,你似乎需要。

Use TableLayout.LayoutParams or TableRow.LayoutParams. They inherit ViewGroup.MarginLayoutParams, which you seem to need.

一个样本code与TableRow.LayoutParams可能是:

A sample code with TableRow.LayoutParams could be:

// you can also init values for width, height and weight here
TableRow.LayoutParams params = new TableRow.LayoutParams();
params.setMargins(LEFT_MARGIN, TOP_MARGIN, RIGHT_MARGIN, BOTTOM_MARGIN);

TextView textView = new TextView(this);
textView.setText("I'm in the table");

TableRow row = new TableRow();
row.addView(textView, params);

同样的原理也与TableLayout.LayoutParams应用,当你添加到表格的布局。

The same principle could be applied with TableLayout.LayoutParams, when you add to the table layout.