开发者

WYSIWYG View Editor in 'Android'?

开发者 https://www.devze.com 2022-12-19 02:40 出处:网络
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开发者_JAVA技巧 Lay

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开发者_JAVA技巧 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?


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


The Android plugin in Eclipse has a WYSIWYG editor, just open on the layout xml file. However I'm guessing you already know this and want instead to know how to do absolute positioning in a visual editor. The short answer is "no", because Android screens come in lots of different shapes and sizes, unlike (for now) the iPhone.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号