title: Android ScrollView dissapearing the rest of my UI
body: <p>I'm new to Android layout design. My problem is that when trying to add a <a href="https://developer.android.com/reference/android/widget/ScrollView" rel="nofollow noreferrer">ScrollView</a> to my layout it disappears the rest of my UI. In the following code, when I uncomment the ScrollView, it happens the aforementioned problem.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;androidx.constraintlayout.widget.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;
      tools:context=&quot;.activity.SettingActivity&quot;&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          android:orientation=&quot;vertical&quot;&gt;
  
          &lt;androidx.appcompat.widget.Toolbar
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:background=&quot;?attr/colorPrimary&quot;
              android:minHeight=&quot;?attr/actionBarSize&quot;
              android:theme=&quot;?attr/actionBarTheme&quot;
              app:title=&quot;Toolbar Title&quot; /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;!--    &lt;ScrollView--&gt;
      &lt;!--        android:layout_width=&quot;match_parent&quot;--&gt;
      &lt;!--        android:layout_height=&quot;match_parent&quot;&gt;--&gt;
  
      &lt;LinearLayout
          android:layout_width=&quot;0dp&quot;
          android:layout_height=&quot;0dp&quot;
          android:layout_marginStart=&quot;10dp&quot;
          android:layout_marginTop=&quot;70dp&quot;
          android:layout_marginEnd=&quot;10dp&quot;
          android:layout_marginBottom=&quot;1dp&quot;
          android:orientation=&quot;vertical&quot;
          app:layout_constraintBottom_toBottomOf=&quot;parent&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:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 1&quot;
              android:textAlignment=&quot;center&quot;
              android:textSize=&quot;15sp&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;RadioGroup
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;horizontal&quot;&gt;
  
              &lt;RadioButton
                  android:layout_width=&quot;193dp&quot;
                  android:layout_height=&quot;48dp&quot;
                  android:text=&quot;Radio 1&quot; /&gt;
  
              &lt;RadioButton
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;48dp&quot;
                  android:text=&quot;Radio 2&quot; /&gt;
          &lt;/RadioGroup&gt;
  
          &lt;View style=&quot;@style/Divider&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 2&quot;
              android:textAlignment=&quot;center&quot;
              android:textSize=&quot;15sp&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 2 Description&quot;
              android:textAlignment=&quot;center&quot; /&gt;
  
          &lt;LinearLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;vertical&quot;&gt;
  
              &lt;TextView
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:text=&quot;Sub-option 2.1&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
  
              &lt;EditText
                  android:layout_width=&quot;135dp&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:autofillHints=&quot;no&quot;
                  android:ems=&quot;10&quot;
                  android:inputType=&quot;numberSigned&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;2&quot;
                  android:textAlignment=&quot;center&quot;
                  tools:ignore=&quot;LabelFor&quot; /&gt;
  
              &lt;TextView
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:text=&quot;Sub-option 2.2&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
  
              &lt;EditText
                  android:layout_width=&quot;135dp&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:autofillHints=&quot;no&quot;
                  android:ems=&quot;10&quot;
                  android:inputType=&quot;numberSigned&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;3&quot;
                  android:textAlignment=&quot;center&quot;
                  tools:ignore=&quot;LabelFor&quot; /&gt;
  
              &lt;TextView
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:text=&quot;Sub-option 2.3&quot;
                  android:textStyle=&quot;bold&quot; /&gt;
  
  
              &lt;EditText
                  android:layout_width=&quot;135dp&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:layout_weight=&quot;1&quot;
                  android:autofillHints=&quot;no&quot;
                  android:ems=&quot;10&quot;
                  android:inputType=&quot;numberSigned&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;2&quot;
                  android:textAlignment=&quot;center&quot;
                  tools:ignore=&quot;LabelFor&quot; /&gt;
  
          &lt;/LinearLayout&gt;
  
          &lt;View style=&quot;@style/Divider&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 3&quot;
              android:textAlignment=&quot;center&quot;
              android:textSize=&quot;15sp&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 3.1&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;Spinner
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:minHeight=&quot;48dp&quot;
              tools:ignore=&quot;DuplicateSpeakableTextCheck&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 3.2&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;Spinner
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:minHeight=&quot;48dp&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 3.3&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;Spinner
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:minHeight=&quot;48dp&quot; /&gt;
  
          &lt;View style=&quot;@style/Divider&quot; /&gt;
  
          &lt;TextView
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Option 4&quot;
              android:textAlignment=&quot;center&quot;
              android:textSize=&quot;15sp&quot;
              android:textStyle=&quot;bold&quot; /&gt;
  
          &lt;LinearLayout
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:orientation=&quot;vertical&quot;&gt;
  
              &lt;androidx.appcompat.widget.SwitchCompat
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;Option 4.1&quot; /&gt;
  
  
              &lt;androidx.appcompat.widget.SwitchCompat
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;txt_option_4_2&quot; /&gt;
  
              &lt;androidx.appcompat.widget.SwitchCompat
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:minHeight=&quot;48dp&quot;
                  android:text=&quot;txt_option_4_3&quot; /&gt;
          &lt;/LinearLayout&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;!--    &lt;/ScrollView&gt;--&gt;
  
  &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  </code></pre>
  <p>How can I add properly a ScrollView to my UI? I also feel like I could make my code much better, so I'm open to any suggestion related to it.</p>
  <p><em>Note: I have omitted ids and hardcoded strings rather than using @string resource here.</em></p>