u can do it in your xml file with tablelayout and tablerow
<TableLayout android:id="@+id/widget253"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0,1,2"
xmlns:android="http://schemas.android.com/apk/res/android">
<TableRow android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/btn1"
android:text="Mon" />
<Button android:id="@+id/btn2"
android:text="Tue" />
<Button android:id="@+id/btn3"
android:text="Wed" />
</TableRow>
<TableRow android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/btn4"
android:text="Mon" />
<Button android:id="@+id/btn5"
android:text="Tue" />
<Button android:id="@+id/btn6"
android:text="Wed" />
</TableRow>
<TableRow android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/btn7"
android:text="Mon" />
<Button android:id="@+id/btn8"
android:text="Tue" />
<Button android:id="@+id/btn9"
android:text="Wed" />
</TableRow>
</TableLayout>
greets
chris
On Jun 14, 4:49 am, Dan Lee <[email protected]> wrote:
> Hi
>
> I am totally newbie for android.
> Today I wrote one example code.
> I would put them 3X3. but buttons won't be in same row.
>
> What I want is here...
>
> button1 button2 button3
>
> button4 button5 button6
>
> button7 button8 button9
>
> Here's my example code...
>
> =================
> public class butt_test1 extends Activity {
> private TextView displayView;
>
> private Button AddMenu1;
> private Button AddMenu2;
>
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.main);
>
> AddMenu1 = (Button)findViewById(R.id.btn1);
> AddMenu2 = (Button)findViewById(R.id.btn2);
>
> }
>
> }
>
> =================
>
> here's xml file
> =================
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
> android:orientation="vertical"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> >
>
> <Button android:id="@+id/btn1"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="booooooton1"/>
>
> <Button android:id="@+id/btn2"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:text="boooooooton2"/>
> </LinearLayout>
>
> =================
>
> Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---