1. Download our Official Android App: Forums for Android!

Apps How to space elements inside a table row layout

Discussion in 'Android Development' started by Marcio Valenzuela, Apr 20, 2016.

  1. Marcio Valenzuela

    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Apr 14, 2016

    Apr 14, 2016
    2
    0
    5
    Male
    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
     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,279
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,279
    10,379
    1,988
    Male
    Software developer
    South West of England
    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.
     

Share This Page

Loading...