How to disable automatic alignment?

I am building an Android project and I am using eclipse. I just can't figure out how to disable annoying auto-alignment. I just want to place the buttons wherever I want to place them on the GUI interface, but it just keeps aligning them with each other. I tried removing these alignment lines in the xml code but it still returns them when I move the buttons on the GUI interface.

Is there any way to disable this feature?

Thanks,

Alex

+8
android eclipse alignment
source share
2 answers

Is there any way to disable this feature?

Not that you find satisfactory, I suspect.

You really did not explain what the “alignment lines" are, so we have to guess. I assume that the "alignment lines" are related to the fact that you are working with a RelativeLayout container. Quoting JavaDocs for RelativeLayout , RelativeLayout :

A layout where children's positions can be described relative to each other or to the parent.

And, quoting a guide for RelativeLayout :

RelativeLayout is a group of views that displays child views in relative positions. The position of each view can be specified both relative to the elements of the marriage (for example, to the left or below another view) or in positions relative to the parent area of ​​the RelativeLayout (for example, aligned to the bottom to the left of the center).

Therefore, “alignment lines” exist and are replaced by the GUI builder because they are the point using the RelativeLayout container.

Of course, you can change the container you are working with, something else.

However, in general, Android does not support your stated goal very well ("I just want to place the buttons wherever I want to place them in the GUI"). Just as you do not do this in web development, you do not do this in Android development for the same reason: you need to consider different sizes (browser window size for the Internet, screen size for Android). RelativeLayout , LinearLayout , TableLayout and GridLayout are for you to specify widgets plus rules for positioning and size, so you can design a user interface that will take into account the difference between 3 "and 4.5", for example. This is akin to using HTML tags and CSS rules to define content and position it on a web page. The Eclipse drag-and-drop Android GUI constructor can help with your definitions of these rules, as you might see your “alignment lines” for RelativeLayout .

+7
source share

I think I can help. If you set your layout to Relative Layout, you can drag and drop any views wherever you are on the eclipse GUI.

0
source share

All Articles