Android Studio My First App Issues


#1

Hi, I’ve recently started using Android Studio and am stuck with understanding ConstraintLayout. Following the guide I am not sure why the one in the guide (pic1) looks different to my activity_main.xml (pic2).
I’ve tried the “infer constraints”
I’m relatively new to coding as you can probably tell. Thanks for any help!

pic1

!
pic2
!


#2

Hello @meganinja26346,

The ConstraintLayout needs to be anchored in order to keep in place the TextView or any element inside it, as you can see at the guide, he dragged and dropped the text box inside the ConstraintLayout (check the component Tree) and gave the correct spacing to each side of the view.