I'm building an android project and I'm using eclipse. I just can't figure out how to disable the annoying auto alignment. I just want to place buttons wherever I want to drop them on the GUI interface but it just keeps to align them one to another. I've tried to delete those alignment lines in the xml code but it still brings them back as I move the buttons on the GUI interface.
Is there an way to disable that function?
Thank you,
Alex
Vertical and/or horizontal orange lines will appear to visualize the alignment. Canvas snapping is enabled by default. To disable it, click the View tab > Canvas Snapping. Temporarily disable canvas snapping by holding down CTRL when you drag or resize objects.
On the View tab, in the Visual Aids group, click the dialog box launcher. On the General tab, under Currently active, clear the Snap check box to deactivate snap, or select Snap to activate snap. Under Snap to, select the drawing elements that you want shapes to snap into alignment with, and then click OK.
Snap to grid in Google Docs presentations allows you to easily auto-align text, images, shapes, and tables within your slides. How to access what's new: Snap to grid is enabled by default. To disable or re-enable snap to grid select 'Arrange' and select/unselect 'Snap to grid'.
Snapping lets you easily align objects with each other when moving, resizing, or drawing an object. As the selected object nears a snap target, it automatically jumps to that point. Toggle whether snapping is active by selecting View > Snap in the top menu.
Is there an way to disable that function?
Not in a way that you will find satisfactory, I suspect.
You have not really explained what the "alignment lines" are, so we are forced to guess. My guess is that the "alignment lines" are because you are working with a RelativeLayout
container. Quoting the JavaDocs for RelativeLayout
, RelativeLayout
is:
A Layout where the positions of the children can be described in relation to each other or to the parent.
And, quoting the guide for RelativeLayout
:
RelativeLayout is a view group that displays child views in relative positions. The position of each view can be specified as relative to sibling elements (such as to the left-of or below another view) or in positions relative to the parent RelativeLayout area (such as aligned to the bottom, left of center).
Hence, the "alignment lines" are there, and are replaced by the GUI builder, because they are the point behind using a RelativeLayout
container.
Of course, you are welcome to change the container that you are working with to something else.
However, in general, Android does not really support very well your stated objective ("I just want to place buttons wherever I want to drop them on the GUI interface"). Just as you don't do that in Web development, you don't do that in Android development, and for much the same reason: you need to take different sizes into account (browser window size for Web, screen size for Android). RelativeLayout
, LinearLayout
, TableLayout
, and GridLayout
are all designed to have you specify widgets plus rules for positioning and sizing, so that you can design a UI that will accommodate the difference between a 3" and a 4.5" screen, for example. This is akin to using HTML tags and CSS rules to define content and its positioning in a Web page. Eclipse's drag-and-drop GUI builder for Android can assist in your definitions of these rules, as you are perhaps seeing with your "alignment lines" for RelativeLayout
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With