XML Table layout? Two EQUAL-width rows filled with equally width buttons??

Posted by Oliver Goossens on Stack Overflow See other posts from Stack Overflow or by Oliver Goossens
Published on 2010-05-19T12:36:33Z Indexed on 2010/05/19 12:40 UTC
Read the original article Hit count: 482

Filed under:
|
|
|

Hi heres a part from my XML for LAND format:

<TableLayout
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_gravity="center"
    android:stretchColumns="*">
<TableRow>    
    <Button
        android:id="@+id/countbutton"
        android:text="@string/plus1"/>      
    <Button
        android:id="@+id/resetbutton"
        android:text="@string/reset" 
        />  
</TableRow>
</TableLayout>

And now what I dont get - the WIDTH of one row and also of the button depends on the TEXT inside the button. If the both texts are equaly long lets say : TEXT its ok - the table half is in the middle of the screen. But if they have different size - lets say "A" and "THIS IS THE LONG BUTTON" the CENTER of the table isnt in the middle of the screen anymore and so the buttons are not equally width...

Cant find any solution...

Please advise...

Thank you

Oliver Goossens

© Stack Overflow or respective owner

Related posts about Xml

Related posts about android