title: how to make a constraint layout scrollable
body: <p>Hello I'm trying to make one of my fragment's layout scrollable but can't reach my goal despite having looking for a solution during many hours. I removed all of the <code>layout_constraintBottom_toBottomOf=&quot;parent&quot;</code> constraints inside the main constraint layout and also set the height of the layout to <code>wrap_content</code>. Finally I set the <code>fillViewPort</code> attribute of the scrollView to true but the result remains the same. Can someone help me please ?
  Here's my .xml file :</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;ScrollView
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_height=&quot;match_parent&quot;
      android:layout_width=&quot;match_parent&quot;
      android:fillViewport=&quot;true&quot;&gt;
          &lt;androidx.constraintlayout.widget.ConstraintLayout
              android:id=&quot;@+id/layout&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;&gt;
  
                  &lt;ProgressBar
                      android:id=&quot;@+id/challengeProgressBar&quot;
                      style=&quot;@android:style/Widget.DeviceDefault.Light.ProgressBar.Large&quot;
                      android:layout_width=&quot;100dp&quot;
                      android:layout_height=&quot;100dp&quot;
                      android:layout_marginTop=&quot;300dp&quot;
                      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                      app:layout_constraintStart_toStartOf=&quot;parent&quot;
                      app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
                  &lt;ImageView
                      android:id=&quot;@+id/errorImageView&quot;
                      android:layout_width=&quot;100dp&quot;
                      android:layout_height=&quot;100dp&quot;
                      android:layout_marginTop=&quot;300dp&quot;
                      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                      app:layout_constraintStart_toStartOf=&quot;parent&quot;
                      app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
                  &lt;androidx.constraintlayout.widget.ConstraintLayout
                      android:id=&quot;@+id/visibleLayout&quot;
                      android:layout_width=&quot;0dp&quot;
                      android:layout_height=&quot;match_parent&quot;
                      app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                      app:layout_constraintHorizontal_bias=&quot;0.0&quot;
                      app:layout_constraintStart_toStartOf=&quot;parent&quot;
                      app:layout_constraintTop_toTopOf=&quot;parent&quot;&gt;
  
                          &lt;TextView
                              android:id=&quot;@+id/profileNameTextView&quot;
                              android:layout_width=&quot;wrap_content&quot;
                              android:layout_height=&quot;wrap_content&quot;
                              android:layout_marginTop=&quot;10dp&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/profileImageView&quot; /&gt;
  
                          &lt;ImageView
                              android:id=&quot;@+id/profileImageView&quot;
                              android:layout_width=&quot;150dp&quot;
                              android:layout_height=&quot;150dp&quot;
                              android:layout_marginStart=&quot;143dp&quot;
                              android:layout_marginTop=&quot;45dp&quot;
                              android:layout_marginEnd=&quot;143dp&quot;
                              android:padding=&quot;5dp&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toTopOf=&quot;parent&quot;
                              tools:src=&quot;@tools:sample/avatars&quot; /&gt;
  
                          &lt;TextView
                              android:id=&quot;@+id/uploadStatusTextView&quot;
                              android:layout_width=&quot;wrap_content&quot;
                              android:layout_height=&quot;0dp&quot;
                              android:layout_marginTop=&quot;4dp&quot;
                              android:layout_marginBottom=&quot;4dp&quot;
                              app:layout_constraintBottom_toTopOf=&quot;@+id/profileImageView&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
                          &lt;TextView
                              android:id=&quot;@+id/nbPointsTextView&quot;
                              android:layout_width=&quot;wrap_content&quot;
                              android:layout_height=&quot;wrap_content&quot;
                              android:layout_marginTop=&quot;30dp&quot;
                              android:textAppearance=&quot;@style/TextAppearance.AppCompat.Display1&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintHorizontal_bias=&quot;0.498&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/profileNameTextView&quot; /&gt;
  
                          &lt;Button
                              android:id=&quot;@+id/completedChallengesButton&quot;
                              android:layout_width=&quot;0dp&quot;
                              android:layout_height=&quot;40dp&quot;
                              android:layout_marginStart=&quot;75dp&quot;
                              android:layout_marginTop=&quot;52dp&quot;
                              android:layout_marginEnd=&quot;75dp&quot;
                              android:text=&quot;@string/completed_challenges&quot;
                              android:textSize=&quot;10sp&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/nbPointsTextView&quot; /&gt;
  
                          &lt;androidx.recyclerview.widget.RecyclerView
                              android:id=&quot;@+id/completedChallengesRecyclerView&quot;
                              android:layout_width=&quot;0dp&quot;
                              android:layout_height=&quot;150dp&quot;
                              android:layout_marginStart=&quot;75dp&quot;
                              android:layout_marginEnd=&quot;75dp&quot;
                              android:background=&quot;@drawable/border&quot;
                              android:visibility=&quot;visible&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/completedChallengesButton&quot; /&gt;
  
                          &lt;Button
                              android:id=&quot;@+id/challengesButton&quot;
                              android:layout_width=&quot;0dp&quot;
                              android:layout_height=&quot;40dp&quot;
                              android:layout_marginStart=&quot;75dp&quot;
                              android:layout_marginEnd=&quot;75dp&quot;
                              android:text=&quot;@string/current_challenges&quot;
                              android:textSize=&quot;10sp&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/completedChallengesRecyclerView&quot; /&gt;
  
                          &lt;androidx.recyclerview.widget.RecyclerView
                              android:id=&quot;@+id/challengesRecyclerView&quot;
                              android:layout_width=&quot;0dp&quot;
                              android:layout_height=&quot;150dp&quot;
                              android:layout_marginStart=&quot;75dp&quot;
                              android:layout_marginTop=&quot;8dp&quot;
                              android:layout_marginEnd=&quot;75dp&quot;
                              android:background=&quot;@drawable/border&quot;
                              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
                              app:layout_constraintHorizontal_bias=&quot;1.0&quot;
                              app:layout_constraintStart_toStartOf=&quot;parent&quot;
                              app:layout_constraintTop_toBottomOf=&quot;@+id/challengesButton&quot; /&gt;
  
                  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
          &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/ScrollView&gt;
  </code></pre>