• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to space elements inside a table row layout

I have this green TableLayout with 6 TableRows in it, each row containing a seekBar and textview in them.
I need to make the seekbars spread out through about 80% of the TableRow and leave the remaining 20% for the TextView.

How can I achieve this?

Screenshot 2016-04-20 15.31.27.png
 
It can be quite fiddly getting layouts to look the way you want. For each item in the row layout, you can assign a 'weight'. This determines how much space is taken up by that item.
You could also set an absolute width for each item. Although that's not ideal because it probably wouldn't work properly in a different orientation, or on different size screens.
Best thing is just try and experiment with different weight values. A higher value means that item is more important, and takes up more space.
Look at this http://www.techrepublic.com/article...ation-with-this-android-tablelayout-solution/
Also Google for 'Android table row weight' or similar.
 
Back
Top Bottom