Android Build an Interactive Story App User Input Using ConstraintLayouts and ImageViews

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).

activity_main.xml
<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>

1 Answer

Jeff Wilton
Jeff Wilton
16,629 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.