views:

879

answers:

1

Duplicate: Is there any form designer available for Google Android?

I would like to move a CheckBox, so it displays in a different location than the top-left corner under Absolute Layout inside main.xml, for 'Android'. I'm using Eclipse to edit my views. How would I do this?

On an iPhone they have a tool called Interface builder that allows you to move things in a WYIWYG fashion. Does Eclipse have similar functionality?

Regards

ShotSimon

A: 

I recommend using a RelativeLayout. You can position your checkbox in relation to other views or the parent view, for example if you want to position it on the right hand side and below a TextView, you could use something like

<RelativeLayout
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
  <TextView
    android:id="@+id/textview"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Text"
    />
  <CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/textview"
    />
</RelativeLayout>

Also have a look at droiddraw.org but I recommend writing the code yourself as it speeds up the process if you ever need to edit/re-use.

For more info on RelativeLayout look at http://d.android.com/reference/android/widget/RelativeLayout.html

disretrospect