Rajapandian Rajapandian - 9 months ago 48
Android Question

How to create a SpreadSheet kind of display in Android?

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.


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

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();

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

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

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