title: Scrollable Textview in Constraint Layout
body: <p>I am working on constraint layout I have three views. First is on top and 2nd have relative position to view1 and then last is below the view 2. Now in 2nd view I have textview which should be scrollable. Problem is scrollview height covering full screen but I want it to have fix height and do not move view 3 out of the screen. I do not want to hard code the height of scrollview so did know what should be the other way to solve it. In short 2nd view should remain between the view 1 and view 3 regardless of text length.</p>
  <pre><code>&lt;android.support.constraint.ConstraintLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;
      xmlns:tools=&quot;http://schemas.android.com/tools&quot;
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;match_parent&quot;
      android:layout_margin=&quot;20dp&quot;&gt;
  
  
      &lt;ImageView
          android:id=&quot;@+id/imageView&quot;
          android:layout_width=&quot;48dp&quot;
          android:layout_height=&quot;48dp&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;parent&quot;
          app:srcCompat=&quot;@drawable/aandn_icon&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/textView&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginLeft=&quot;16dp&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:minHeight=&quot;48dp&quot;
          android:text=&quot;Lorem ipsum&quot;
          app:layout_constraintLeft_toRightOf=&quot;@+id/imageView&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;@+id/imageView&quot; /&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/imageView2&quot;
          android:layout_width=&quot;48dp&quot;
          android:layout_height=&quot;48dp&quot;
          android:layout_marginTop=&quot;16dp&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/textView&quot;
          app:srcCompat=&quot;@drawable/aandn_icon&quot; /&gt;
  
  
      &lt;ScrollView
          android:id=&quot;@+id/scrolltext&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          app:layout_constraintLeft_toRightOf=&quot;@+id/imageView2&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;@+id/imageView2&quot;&gt;
  
          &lt;android.support.constraint.ConstraintLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;&gt;
  
  
              &lt;TextView
                  android:id=&quot;@+id/start_tv4&quot;
                  android:layout_width=&quot;wrap_content&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_alignBaseline=&quot;@+id/sound&quot;
                  android:layout_gravity=&quot;top|left&quot;
                  android:layout_toLeftOf=&quot;@+id/sound&quot;
                  android:text=&quot;Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  Definition: A happening or sudden event that is not wanted or expected.Example: The cars collided unexpectedly on the road causing an accident.||
  &quot;
                  android:textColor=&quot;#000000&quot;
                  android:textSize=&quot;20sp&quot; /&gt;
  
  
          &lt;/android.support.constraint.ConstraintLayout&gt;
  
      &lt;/ScrollView&gt;
  
      &lt;ImageView
          android:id=&quot;@+id/imageView4&quot;
          android:layout_width=&quot;48dp&quot;
          android:layout_height=&quot;48dp&quot;
          android:layout_marginTop=&quot;16dp&quot;
          app:layout_constraintLeft_toLeftOf=&quot;parent&quot;
          app:layout_constraintTop_toBottomOf=&quot;@+id/scrolltext&quot;
          app:srcCompat=&quot;@drawable/aandn_icon&quot; /&gt;
  
      &lt;TextView
          android:id=&quot;@+id/textView4&quot;
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_marginLeft=&quot;16dp&quot;
          android:layout_marginStart=&quot;16dp&quot;
          android:minHeight=&quot;48dp&quot;
          android:text=&quot;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. &quot;
          app:layout_constraintLeft_toRightOf=&quot;@+id/imageView4&quot;
          app:layout_constraintRight_toRightOf=&quot;parent&quot;
          app:layout_constraintTop_toTopOf=&quot;@+id/imageView4&quot; /&gt;
  
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  <p><strong>this is the output</strong></p>
  <p><a href="https://i.stack.imgur.com/T1oga.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T1oga.png" alt="enter image description here" /></a></p>