Problem dragging components in Android Studio

Asked

Viewed 1,328 times

0

inserir a descrição da imagem aqui

I’m starting to use android studio today, this blue box on the right layout side ta?

And every time I drag components into the middle, the button goes up by itself, but the button checkbox is still in the middle. Someone knows?

  • Have a look: https://developer.android.com/training/constraint-layout/index.html

  • I don’t even know English man, but from what I’ve seen, I’ve changed the position myself?

  • Dude, if you can’t, go to the text part and change the guy to RelativeLayout or LinearLayout, it would be easier for you

2 answers

1

Good morning ! Henrrique, in this case this is happening because you are using Coordinatorlayout, which came by default when you created the project and the Main class. If you are a beginner in Android development I suggest you start using the Layouts: Relativelayout and Linearlayout because they are the simplest and most intuitive. Relativelayput is perfect for what you’re trying to do, so use it follow these steps:

  1. Click on the Text tab at the bottom of the Print window, Next to Design;
  2. After the XML header, replace the entire Coordinatorlayout package (com.android. ... .Coordinatorlayout) with Relativelayout;
  3. Okay, now just go back to the Design tab and drag and position the components on the screen as you prefer;

Linearlayout works with the sorting issue, where you can define the orientation (horizontal or vertical) and the components will always be aligned one after the other effortlessly; Constraintlayout came with version 2.3 of Androidstudio and works in a similar way to Relative, but with more emphasis on screen portability, I suggest you research some sample tutorial using this ! I hope I’ve helped :)

0

I don’t usually use layout mode. So here’s my solution:

  1. switch to text mode.
  2. Change the layout type (by default it comes as ConstraintLayout) for LinearLayout.
  3. Enter the orientation = vertical tag below the dimensions.
  4. Enter the option layout_gravity = center and your button will be centered.

And you have a rendering problem in your project. Expose it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.