0

Sorry for killing you with noob mistakes I guess. I just started android development following a tutorial, tutorial in different AS version. I have typed in just what the instructor has but final results are not the same.

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="229dp"
android:minWidth="400dp"
tools:context="com.rjrenegade.myfirstexampleapp.MainActivity">

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Rj is awesome!"
    android:textColor="@color/colorAccent"
    android:textSize="30sp"
    tools:layout_editor_absoluteX="20dp"
    tools:layout_editor_absoluteY="30dp" />

<ToggleButton
    android:id="@+id/toggleButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="ToggleButton"
    tools:layout_editor_absoluteX="-57dp"
    tools:layout_editor_absoluteY="-72dp" />

<Button
    android:id="@+id/button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:onClick="clickFunction"
    android:text="I agree"
    tools:layout_editor_absoluteX="20dp"
    tools:layout_editor_absoluteY="88dp" />

</android.support.constraint.ConstraintLayout>

I rechecked several times with the instructors code its all the same. Result: http://imgur.com/a/kZPIG

Edit1: From links on marked as duplicate I understood there must be something called constraints. Now how can I add them to this app in my editor, can some one suggest that please? Documentations seems too cryptic for me.

  • Check the link given in [this answer](https://stackoverflow.com/a/43422980) for the [Autoconnect and Infer constraints features](https://developer.android.com/training/constraint-layout/index.html#use-autoconnect-and-infer-constraints). – Mike M. Aug 28 '17 at 08:05
  • 1
    That's was awesome, I fixed it. This works, so all I had to do is to click the [golden button](http://imgur.com/a/8q8FS). Thanks a lot mike!! – Ramachandra Junior Aug 28 '17 at 08:16

0 Answers0