开发者

Android: Moving buttons freely in Eclipse's Graphical Layout Editor

I've developed several iPhone apps and now I'm porting them onto Android.

From what I was used to, I was able to freely move buttons around using the Interface Editor for the iPhone, and from what I understand for Android, you can (or need) to use the XML layout file to "layout" your buttons and whatnot.

So this means I have to use tables right? Is there a way that I can just freely move a button where I want with my mouse using the graphical layout editor in eclipse?

I've Googled an开发者_运维问答d came upon this thread WYSIWYG View Editor in 'Android'? but I don't think they came up with a good conclusion..

Thanks.

-Paul


The reason for iPhone absolute layouts is that all the screens are the same size. Because there is such a wide variety of android devices, you should try getting used to relative and linear layout construction.

To answer, no, you won't be able to place a button in an exact pixel location using the graphical layout editor.


  • you can (or need) to use the XML layout file to "layout" your buttons and whatnot.

Yes, you can use an xml layout. It's not required, though, as you can also create the whole UI in java.

  • So this means I have to use tables right?

No, there are many layouts available to choose from.

  • Is there a way that I can just freely move a button where I want with my mouse using the graphical layout editor in eclipse?

No, you can't in Eclipse. You can code it and see how it changes it's location in the layout preview. The AbsoluteLayout is deprecated due to the problems it causes with all the different screen sizes around.

The best alternative option is to master the RelativeLayout. It is a very powerful layout that will let you position your UI widgets anywhere in the screen while at the same time makes it easy to support multiple screen sizes.


Try clicking with the second mouse button on the layout. Change the layout. And then choose AbsoluteLayout.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜