Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
i dont have any idea
In a ConstraintLayout, we can center a View by aligning its top, bottom, left, and right all to the edges of its parent. In the layout below, center the ImageView by setting each "layout_constraint" item to "parent" (just fill in the blanks).
<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="" app:srcCompat="@drawable/grumpy_cat" app:layout_constraintTop_toTopOf="" app:layout_constraintBottom_toBottomOf="" app:layout_constraintLeft_toLeftOf="" app:layout_constraintRight_toRightOf="" /> <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/layout_constraint" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parentlayout_constraint" /> </android.support.constraint.ConstraintLayout>
Jeff Wilton16,633 Points
For step one, the task is to find the "layout_constraint" attributes for the ImageView and set them to "parent", which is really just filling in the blanks. Here are the blanks:
app:layout_constraintTop_toTopOf="" app:layout_constraintBottom_toBottomOf="" app:layout_constraintLeft_toLeftOf="" app:layout_constraintRight_toRightOf=""
So, just add parent in between those double quotes and that's it!
If you're ever just really confused on what to do, I sometimes find it really helps to go back and view the previous video, since the challenges usually involve doing exactly what was shown in the video.