Codrin Postu8,020 Points
All the items I drag and drop on the layout just go to the top left corner
Is there anyone that could explain why this happens? I don't get the blue dotted lines or arrows when I use RelativeLayout and I don't know what setting I am missing.
I can edit it manually in XML file but I am curious why for Ben it works just by dragging and for me it doesn't
Here is what it looks like: https://i.imgur.com/vsxeY13.png
Edit: I managed to get them to be in a certain position on the screen but I do not have the dotted lines or centered lines to help me align them properly. Is there a setting to turn them on?
Hi Codrin. I think that when that video was recorded, RelativeLayout was the default root layout. Now it's ConstraintLayout and afaik you no longer get these guidelines by default with the RelativeLayout.
You can try the following in the Layout Editor:
- Click on the magnet icon (next to the eye icon, top left, next to the Palette menu) so that it's not crossed out: this turns on Autoconnect.
- Drag a new view onto your layout.
- You will see 2 grey lines (1 horizontal and 1 vertical) coming out of that view as you move it along the layout (along with dimensions). They're 2 default constraints to the parent layout.
- Click on the (red) dot on the view frame to remove both constraints. At this point, your view should be back at the top left corner
- Now as you move your view again around the layout, you should see the horizontal and vertical guidelines appear in bold green. Release your view when you're happy with its position.
- Repeat with the next view (remove the 2 default constraints). You will see thinner green lines to help you align that new view to the previous one too.
I hope this helps :) If it's unclear, let me know and I'll include screenshots.
Thanks a lot. I had the same problem but not it is working.