androidandroid-studioandroid-constraintlayoutandroid-studio-bumblebee

Updating margin values in view inspector has no effect on layout


I am following this tutorial and am unable to make Box Three line up to the top of Box Two (which she shows how to do at around 1:45 in the video).

As you can see in the screenshot, I try setting the top margin to 0 but it has no effect on the layout. If I inspect the value again, I see that it has gone back to 16. I am really unsure what I am doing wrong here as I have been following the video quite closely. The tutorial is quite old from 2016 and I am using the newest version of android studio (bumblebee).

Screenshot of me setting the value to 0 but not having any effect on the display: enter image description here

How can I make the margin 0??


Solution

  • This is a bug in the latest release: Setting marginTop doesn`t apply when using interface builder, only through XML code. That being said, the issue can be resolved, as you already figured out, by setting the value via 'Declared attributes' from the design view or by declaring the value in your code with 'android:layout_marginTop="0dp"' on your view.