Problem dragging components in Android Studio

0

I'm starting to use android studio today, this blue box on the side of the layout is right?

And whenever I drag components into the middle, the button goes up alone, but the button's selection box remains in the middle. Does anyone know?

    
asked by anonymous 15.04.2018 / 01:03

2 answers

0

Good morning! Henrrique, in this case this is happening because you are using the 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 by using Layouts: RelativeLayout and LinearLayout because they are the simplest and most intuitive. RelativeLayput is perfect for what you're trying to do, to use it follow these steps:

  • Click the Text tab at the bottom of the Print window, next to Design;
  • Just after the XML header replace the entire CoordinatorLayout package (com.android..CoordinatorLayout) with RelativeLayout;
  • Now, just go back to the Design tab and drag and drop the components on the screen as you like;
  • LinearLayout works with the sort order, where you can set 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 similarly to Relative, but with more emphasis on screen portability, I suggest you research some example tutorial to use this! I hope I have helped :)

        
    06.07.2018 / 16:07
    -1

    I do not usually use layout mode. So here's my solution:

  • switch to text mode.
  • Change the layout type (by default it comes as ConstraintLayout ) to LinearLayout .
  • Enter the orientation = vertical tag below the dimensions.
  • Enter the layout_gravity = center option and your button will be centered.
  • And you have a rendering problem in your project. Expose it.

        
    06.07.2018 / 13:43