Hi

Check this code

Image link :

http://www.freeimagehosting.net/d3xav

xml code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

<TextView  android:gravity="center" android:textSize="24dp"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Sample program"/>

<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="0,1,2" >

<TableRow android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button android:id="@+id/b1" android:text="01" />
    <Button android:id="@+id/b2" android:text="02"/>
    <Button android:id="@+id/b3" android:text="03"/>
</TableRow>
<TableRow >
    <Button android:id="@+id/b4" android:text="04"/>
    <Button android:id="@+id/b5" android:text="05"/>
    <Button android:id="@+id/b6" android:text="06"/>
</TableRow>
<TableRow >
    <Button android:id="@+id/b7" android:text="07"/>
    <Button android:id="@+id/b8" android:text="08"/>
    <Button android:id="@+id/b9" android:text="09"/>
</TableRow>
<TableRow android:gravity="center" ><Button android:text="Hello"
android:layout_height="fill_parent"
    android:layout_width="fill_parent"/></TableRow>
</TableLayout>

</LinearLayout>



On Wed, Jan 11, 2012 at 10:29 PM, jlau <marketisalwaysri...@gmail.com>wrote:

> Hi
> I was trying to arrange 9 Buttons in TableLayout.(main.xml below)
>
> On the eclipse "Graphical Layout", it looked ok, Buttons spaced out
> nicely. Somehow on the emulator, all the 9 Buttons looked "joined"
>
> Here's the screenshot:
> http://www.freeimagehosting.net/sagst
>
> Yet to try on actual device but does anyone know why this is
> happening?
>
> Thanks in advance!
> --jason
>
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>    android:layout_width="fill_parent"
>    android:layout_height="fill_parent"
>    android:orientation="vertical" >
>
>    <TextView
>        android:id="@+id/score"
>        android:layout_width="fill_parent"
>        android:layout_height="wrap_content"
>        android:gravity="center|bottom"
>        android:text="@string/score"
>        android:textSize="20dip" />
>
>    <TableLayout
>        android:layout_width="fill_parent"
>        android:layout_height="wrap_content"
>        android:stretchColumns="0,1,2" >
>
>        <TableRow >
>            <Button
>                android:id="@+id/button1"
>                />
>            <Button
>                android:id="@+id/button2"
>                android:text="" />
>            <Button
>                android:id="@+id/button3"
>                android:text="" />
>        </TableRow>
>        <TableRow >
>            <Button
>                android:id="@+id/button4"
>                android:text="" />
>            <Button
>                android:id="@+id/button5"
>                android:text="" />
>            <Button
>                android:id="@+id/button6"
>                android:text="" />
>        </TableRow>
>        <TableRow >
>            <Button
>                android:id="@+id/button7"
>                android:text="" />
>            <Button
>                android:id="@+id/button8"
>                android:text="" />
>            <Button
>                android:id="@+id/button9"
>                android:text="" />
>        </TableRow>
>    </TableLayout>
>
>    <Button
>        android:id="@+id/rstButton"
>        android:layout_width="fill_parent"
>        android:layout_height="wrap_content"
>        android:text="Restart" />
>
> </LinearLayout>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to