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 trial

Chido Vambe
4,638 Pointsmake sure you set to the right attribute... what am i doing wrong?
Set the top margin of the EditText to be "0dp".
<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">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
app:srcCompat="@drawable/grumpy_cat"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<EditText
android:id="@+id/captionField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter a caption"
android:layout_marginTop="True"
android:layout_marginTop="0dp"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
2 Answers

Steve Hunter
57,712 PointsSo, on task 2 we are asked to Next, we want to position the EditText directly below the ImageView. We do this by constraining its top to the bottom of the ImageView. Set the top margin of the EditText to be "0dp".
The EditText
code starts out like this:
<EditText
android:id="@+id/captionField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter a caption"
android:layout_marginTop=""
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
This has a blank placeholder where we need to enter 0dp
. Adding that gives us this:
<EditText
android:id="@+id/captionField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Enter a caption"
android:layout_marginTop="0dp"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
This passes the task. I'll see if there's something else in your code that's causing the issue - but you don't need two marginTop
attributes.
Steve.

Steve Hunter
57,712 PointsHi there,
You have an extra line in there. Remove:
android:layout_marginTop="True"
as the line below sets the margin to 0dp
.
Steve.

Chido Vambe
4,638 Pointshey Steve, it is still saying "Bummer! Make sure you are setting the correct attribute in the EditText "0dp"!" after removing the line you instructed me to get rid off

Steve Hunter
57,712 PointsWhoops! Sorry! Let me have another look ...
Chido Vambe
4,638 PointsChido Vambe
4,638 Pointsthanks Steve you are right