Elements stacked Android Studio

2

I'm starting in Android Studio (2.3), I made a program with 4 elements (sum of numbers) but at the time of executing it, the elements appear on the top left and I can not manipulate the program, what should it be?

Thanks

    
asked by Edav 24.03.2017 в 02:54
source

3 answers

2

You have support enabled for ConstraintLayout , and you are using as your primary layout a < a href="https://developer.android.com/reference/android/support/constraint/ConstraintLayout.html"> ConstraintLayout , your views are showing at the 0,0 coordinates surely.

Define restrictions on your views so that they appear in the correct position when your application is running :

I did not find a tutorial in Spanish, but I add the one in the documentation:

link

If you do not want to use ConstraintLayout , simply change in your .xml layout, from:

<android.support.constraint.ConstraintLayout 

to another layout type for example LinearLayout :

<LinearLayout 

or RelativeLayout :

   <RelativeLayout
    
answered by 24.03.2017 в 18:39
0

When you are creating applications in android studio, the latest versions come with this default option for responsive interfaces with android:

  

android.support.constraint.ConstraintLayout

which can be deleted from the layout xml in addition to removing it from the gradle.

Then in the XML you change it by:

  

RelativeLayout

From there, you can locate your view anywhere in the RelativeLayout using

  

android: layout_alignParentTop,   android: layout_centerVertical, among other options

or if you want to also place it next to another view you can also add

  

android: layout_toRightOf and others like that

here I leave you from the android developers all about it. enter the description of the link here

    
answered by 27.11.2017 в 23:37
0

I had the same error and it was because of a dependence on the file

AppAndroid \ app \ build.gradle

I changed the

implementation 'com.android.support:appcompat-v7:28.0.0-rc02'

for

implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
    
answered by 08.09.2018 в 01:42