by plusminus » Sun Mar 09, 2008 12:11 pm
Hello cybohemia,
to center more than one View, you'll need to create two Dummy-Views to fill the space to the left and right equally, by setting their [font=Lucida Console]android:layout_weight="1"[/font].
Using xml Syntax Highlighting
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<CheckBox
android:id="@+id/box1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="box1"
android:checked="true"
/>
<CheckBox
android:id="@+id/bxo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="box2"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
Parsed in 0.004 seconds, using
GeSHi 1.0.8.4
Regards,
plusminus


| Android Development Community / Tutorials