I have 2 columns with 10 buttons with a bit longer names and i dont know how to align them.. here is my code.. so please if anyone have an idea how to make it straight?
I have 2 columns with 10 buttons with a bit longer names and i dont know how to align them.. here is my code.. so please if anyone have an idea how to make it straight?
`<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/futuratheme"
android:gravity="center"
android:paddingBottom="25dip" >
<TableRow android:id="@+id/tableRow1" >
<Button
android:id="@+id/bPapir"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_weight="50"
android:text="@string/papir" />
<Button
android:id="@+id/bInformaticki"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:layout_weight="50"
android:text="@string/informaticki" />
</TableRow>
<TableRow android:id="@+id/tableRow5" >
<Button
android:id="@+id/bUredski"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_weight="50"
android:text="@string/uredski" />
<Button
android:id="@+id/bPisaci"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:layout_weight="50"
android:text="@string/pisaci_pribor" />
</TableRow>
<TableRow android:id="@+id/tableRow4" >
<Button
android:id="@+id/bOdlaganje"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_weight="50"
android:text="@string/odlaganje" />
<Button
android:id="@+id/bPrezentacija"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:layout_weight="50"
android:text="@string/prezentacija" />
</TableRow>
<TableRow android:id="@+id/tableRow3" >
<Button
android:id="@+id/button5"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_weight="50"
android:text="Button" />
<Button
android:id="@+id/button6"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:layout_weight="50"
android:text="Button" />
</TableRow>
<TableRow android:id="@+id/tableRow2" >
<Button
android:id="@+id/button3"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="5dip"
android:layout_weight="50"
android:text="Button" />
<Button
android:id="@+id/button4"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_marginRight="15dip"
android:layout_weight="50"
android:text="Button" />
</TableRow>
`
Apply this to each tablerow
Also you may want to add
(example “left|center”, “right|center”) to your buttons, that way it will align the text.