views:

63

answers:

1

Suppose I have a view inside TableLayout, like this:

TableLayout tableLayout;
View view = (View)tableLayout.findViewById(R.id.control);

How can I find out the view's row/column within the TableLayout?

A: 

A view that is within a TableRow should have TableRow.LayoutParams as its LayoutParams. From that you can get the layout_column.

The row seems to be a bit harder. I'd expect the TableLayout.LayoutParams (gotten from the TableRow) to have that information, but it doesn't seem to. You could try using tableLayout.getIndexOfChild(rowView).

Mayra