Search code examples
androidlayoutandroid-studiodesigner

Absolute positioning with drag and drop in the Android Studio


I want make a complex layout, with absolute coordinates, I use RelativeLayout, with left and top margins, but there are a lot of objects, and it is hard to write all that coordinates in the text editor, thus I decided to use Design tab, but it doesn't allow to move second button to an arbitrary position, always snap to an existing objects, I found a solution, at first instead of RelativeLayout wrote AbsoluteLayout, did absolute positioning, and then refacored layout_x and layout_y to layout_marginLeft and layout_marginTop, but I want to know is there an option to turn off snapping in the Design tab when root layout is RelativeLayout Snap is on


Solution

  • No. You can't do absolute positioning in RelativeLayout. It's not "snapping", it's showing you the actual relative payout.

    You can only do absolute positioning in AbsoluteLayout.