Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJavon Carson
2,186 PointsHelp with App layout using AVD.
When I run my program all txt boxes and buttons are in the same place. In my code everything looks like it should. Here is the code.
<?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" tools:context="com.example.missl.funfacts.FunFactsActivity">
<TextView
android:layout_width="160dp"
android:layout_height="55dp"
android:text="Did You Know?"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.063"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.026" />
<TextView
android:id="@+id/funFactTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ants Stretch when they wake up in the morning"
android:textSize="24sp"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="247dp" />
<Button
android:id="@+id/funFactButton"
android:layout_width="395dp"
android:layout_height="wrap_content"
android:text="Show me another fun fact"
android:textSize="24sp"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="539dp"
/>
</android.support.constraint.ConstraintLayout>
1 Answer
Javon Carson
2,186 PointsOK I think I fixed. Had to add Infer Constraints to txt boxes and button.