Setting column widths in table view

I find it difficult to understand how to change the width of the columns when creating a table view.

I know that you can set the width in pixels of a column, but that is not what I want to do.

Say, for example, I have 2 columns and each column occupies half the screen. How to do this without explicitly setting the pixels so that my code can work on multiple screen sizes?

+5
source share
2 answers

With TableLayout? You cannot do it easily. The closest you can get is to use android:stretchColumns="*"for your item TableLayout. This should evenly distribute any extra spaces between the two columns.

+3
source

TableRow layout_width = "0dip" layout_weight = "1" .

0

All Articles