title: Data of addview cannot appeared in linearLayout of scrollview
body: <br/>
  I am trying to applying tutorial,
  this a dummy store app, I showing the data that added from user inside view then added it in linear layout of scrollview, the app is run fine and the data is added to viewmodel I see it in the log but I failed to diplay it in the view and I don't know what the problem is
  <p><a href="https://imgur.com/FlCg5pD" rel="nofollow noreferrer"><img src="https://i.imgur.com/FlCg5pD.gif" title="source: imgur.com" /></a></p>
  <p>The code of model class</p>
  <pre><code>@Parcelize
  data class Shoe(
      var name: String, var size: Double, var company: String, var description: String,
      val images: List&lt;String&gt; = mutableListOf()
  ) : Parcelable
  </code></pre>
  <p><strong>MainViewModel</strong></p>
  <pre><code>class MainViewModel : ViewModel() {
  
      private val _shoesList = MutableLiveData&lt;MutableList&lt;Shoe&gt;&gt;()
      val shoesList: LiveData&lt;MutableList&lt;Shoe&gt;&gt;
          get() = _shoesList
  
      fun addShoe(shoe: Shoe) {
          _shoesList.value?.add(shoe)
      }
  
      init {
          Timber.tag(TAG).i(&quot;: MainViewModel created&quot;)
          val testShoe1 = Shoe(&quot;Test Shoe 1&quot;,
  
              47.0, &quot;dummy shoe company&quot;, &quot;Dummy shoe description&quot;)
          val testShoe2 = Shoe(&quot;Test Shoe 2&quot;,
              40.0, &quot;dummy shoe company&quot;, &quot;Dummy shoe description&quot;)
  
  
          _shoesList.value?.add(testShoe1)
          _shoesList.value?.add(testShoe2)
      }
  
  
  }
  </code></pre>
  <p><strong>fragment_shoe_list layout</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout 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;&gt;
  
      &lt;data&gt;
  
      &lt;/data&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:id=&quot;@+id/shoeListLayout&quot;
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:context=&quot;.ui.ShoeListFragment&quot;&gt;
  
  
          &lt;ScrollView
              android:id=&quot;@+id/scrollView&quot;
              android:layout_width=&quot;match_parent&quot;
              android:layout_height=&quot;match_parent&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;LinearLayout
                  android:id=&quot;@+id/shoeListLinearLayout&quot;
                  android:layout_width=&quot;match_parent&quot;
                  android:layout_height=&quot;wrap_content&quot;
                  android:orientation=&quot;vertical&quot; /&gt;
          &lt;/ScrollView&gt;
  
          &lt;com.google.android.material.floatingactionbutton.FloatingActionButton
              android:id=&quot;@+id/floatingActionButton&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginEnd=&quot;24dp&quot;
              android:layout_marginBottom=&quot;24dp&quot;
              android:clickable=&quot;true&quot;
              android:focusable=&quot;true&quot;
              android:src=&quot;@drawable/ic_baseline_add&quot;
              app:layout_constraintBottom_toBottomOf=&quot;@+id/scrollView&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_toTopOf=&quot;@+id/scrollView&quot;
              app:layout_constraintVertical_bias=&quot;1.0&quot;
              android:contentDescription=&quot;@string/button_add_shoe&quot; /&gt;
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  <p><strong>ShoeListFragment class</strong></p>
  <pre><code>class ShoeListFragment : Fragment() {
  
      private lateinit var binding: FragmentShoeListBinding
  
      private val mainViewModel: MainViewModel by activityViewModels()
  
      private lateinit var showRowBinding: ShoeRowLayoutBinding
  
      private val TAG = &quot;ShoeListFragment&quot;
  
      override fun onCreateView(
          inflater: LayoutInflater,
          container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View {
  
          binding =
              DataBindingUtil.inflate(layoutInflater, R.layout.fragment_shoe_list, container, false)
  
          return binding.root
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  
          mainViewModel.shoesList.observe(viewLifecycleOwner) {
              it.forEach { shoe -&gt;
  
                  Log.d(TAG, &quot;onViewCreated: ${it.toString()}&quot;)
                  
                  Timber.tag(TAG).i(&quot;test shoe ${shoe.name}&quot;)
  
                  showRowBinding = ShoeRowLayoutBinding.inflate(layoutInflater)
  
  
                  showRowBinding.newShoe = shoe
  
                  binding.shoeListLinearLayout.addView(showRowBinding.root)
              }
          }
  
          binding.floatingActionButton.setOnClickListener {
              Timber.i(mainViewModel.shoesList.value?.joinToString(separator = &quot;\n&quot;))
              findNavController().navigate(ShoeListFragmentDirections.actionShoeListFragmentToDetailsFragment())
          }
      }
  }
  </code></pre>
  <p><strong>fragment_details layout</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout 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;&gt;
  
      &lt;data&gt;
  
          &lt;variable
              name=&quot;mainViewModel&quot;
              type=&quot;com.udacity.shoestore.models.MainViewModel&quot; /&gt;
  
          &lt;variable
              name=&quot;shoeData&quot;
              type=&quot;com.udacity.shoestore.models.Shoe&quot; /&gt;
      &lt;/data&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;match_parent&quot;
          tools:context=&quot;.ui.DetailsFragment&quot;&gt;
  
  
          &lt;TextView
              android:id=&quot;@+id/shoeNameTV&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:text=&quot;@string/shoe_name&quot;
              app:layout_constraintBottom_toTopOf=&quot;@+id/shoeNameED&quot;
              app:layout_constraintEnd_toEndOf=&quot;@+id/shoeNameED&quot;
              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/shoeNameED&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/companyNameTV&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:text=&quot;Company Name&quot;
              app:layout_constraintBottom_toTopOf=&quot;@+id/companyNameED&quot;
              app:layout_constraintEnd_toEndOf=&quot;@+id/companyNameED&quot;
              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/companyNameED&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/shoeSizeTV&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:text=&quot;Shoe Size&quot;
              app:layout_constraintBottom_toTopOf=&quot;@+id/shoeSizeED&quot;
              app:layout_constraintEnd_toEndOf=&quot;@+id/shoeSizeED&quot;
              app:layout_constraintHorizontal_bias=&quot;0.0&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/shoeSizeED&quot; /&gt;
  
  
          &lt;TextView
              android:id=&quot;@+id/descTV&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginBottom=&quot;8dp&quot;
              android:text=&quot;Description&quot;
              app:layout_constraintBottom_toTopOf=&quot;@+id/descriptionED&quot;
              app:layout_constraintEnd_toEndOf=&quot;@+id/descriptionED&quot;
              app:layout_constraintHorizontal_bias=&quot;0.007&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/descriptionED&quot; /&gt;
  
          &lt;Button
              android:id=&quot;@+id/cancelButton&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;12dp&quot;
              android:text=&quot;Cancel&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/saveButton&quot; /&gt;
  
          &lt;Button
              android:id=&quot;@+id/saveButton&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;136dp&quot;
              android:text=&quot;Save&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/shoeSizeED&quot; /&gt;
  
          &lt;EditText
              android:id=&quot;@+id/shoeNameED&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;100dp&quot;
              android:ems=&quot;10&quot;
              android:inputType=&quot;textPersonName&quot;
              android:text=&quot;@={shoeData.name}&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.497&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
          &lt;EditText
              android:id=&quot;@+id/descriptionED&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;32dp&quot;
              android:ems=&quot;10&quot;
              android:text=&quot;@={shoeData.description}&quot;
              android:inputType=&quot;textPersonName&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.497&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/companyNameED&quot; /&gt;
  
  
          &lt;EditText
              android:id=&quot;@+id/companyNameED&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;32dp&quot;
              android:ems=&quot;10&quot;
              android:text=&quot;@={shoeData.company}&quot;
              android:inputType=&quot;textPersonName&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.497&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/shoeNameED&quot; /&gt;
  
  
          &lt;EditText
              android:id=&quot;@+id/shoeSizeED&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginTop=&quot;28dp&quot;
              android:ems=&quot;10&quot;
              android:text=&quot;@={`` + shoeData.size}&quot;
              android:inputType=&quot;numberDecimal&quot;
              app:layout_constraintEnd_toEndOf=&quot;parent&quot;
              app:layout_constraintHorizontal_bias=&quot;0.497&quot;
              app:layout_constraintStart_toStartOf=&quot;parent&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/descriptionED&quot; /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>
  <p><strong>FragmentDetails Class</strong></p>
  <pre><code>class DetailsFragment : Fragment() {
  
      private lateinit var binding: FragmentDetailsBinding
  
      private val mainViewModel: MainViewModel by activityViewModels()
  
      override fun onCreateView(
          inflater: LayoutInflater, container: ViewGroup?,
          savedInstanceState: Bundle?
      ): View {
          // Inflate the layout for this fragment
  
          binding =
              DataBindingUtil.inflate(layoutInflater, R.layout.fragment_details, container, false)
  
          binding.mainViewModel = mainViewModel
          binding.lifecycleOwner = this
  
  
          return binding.root
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
  //        binding.mainViewModel = this.mainViewModel
  
          binding.saveButton.setOnClickListener {
  
              if (TextUtils.isEmpty(binding.shoeNameED.text.toString())) {
                  binding.shoeNameED.error = &quot;required text&quot;
              } else if (TextUtils.isEmpty(binding.shoeSizeED.text.toString())) {
                  binding.shoeSizeED.error = &quot;required text&quot;
              } else if (TextUtils.isEmpty(binding.companyNameED.text.toString())) {
                  binding.companyNameED.error = &quot;required text&quot;
              } else if (TextUtils.isEmpty(binding.descriptionED.text.toString())) {
                  binding.descriptionED.error = &quot;required text&quot;
              } else {
  
                  val newShoe = Shoe(
                      name = binding.shoeNameED.text.toString(),
                      size = binding.shoeSizeED.text.toString().toDouble(),
                      company = binding.companyNameED.text.toString(),
                      description = binding.descriptionED.text.toString()
                  )
                  binding.shoeData = newShoe
  
                  Timber.tag(TAG).i(newShoe.toString())
  
                  mainViewModel.addShoe(newShoe)
  
                  findNavController().navigate(DetailsFragmentDirections.actionDetailsFragmentToShoeListFragment())
              }
  
          }
  
      }
  }
  </code></pre>
  <p>and finally this a row layout that should inflated and added to the scrollView</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;layout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      xmlns:app=&quot;http://schemas.android.com/apk/res-auto&quot;&gt;
      &lt;data&gt;
          &lt;variable
              name=&quot;newShoe&quot;
              type=&quot;com.udacity.shoestore.models.Shoe&quot; /&gt;
  
      &lt;/data&gt;
  
      &lt;androidx.constraintlayout.widget.ConstraintLayout
          android:layout_width=&quot;match_parent&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:padding=&quot;20dp&quot;&gt;
  
          &lt;TextView
              android:id=&quot;@+id/company_label&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Company: &quot;
              android:textColor=&quot;@android:color/black&quot;
              android:textStyle=&quot;bold&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/name_label&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/name_label&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Name: &quot;
              android:textColor=&quot;@android:color/black&quot;
              android:textStyle=&quot;bold&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/size_label&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Size: &quot;
              android:textColor=&quot;@android:color/black&quot;
              android:textStyle=&quot;bold&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/company_label&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/company_label&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/desc_label&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:text=&quot;Description: &quot;
              android:textColor=&quot;@android:color/black&quot;
              android:textStyle=&quot;bold&quot;
              app:layout_constraintStart_toStartOf=&quot;@+id/size_label&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/size_label&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/desc_text&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;10dp&quot;
              android:text=&quot;@{newShoe.description}&quot;
              app:layout_constraintStart_toEndOf=&quot;@+id/desc_label&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/size_text&quot; /&gt;
  
  
          &lt;TextView
              android:id=&quot;@+id/size_text&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;10dp&quot;
              android:text=&quot;@{Double.toString(newShoe.size)}&quot;
              app:layout_constraintStart_toEndOf=&quot;@+id/size_label&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/company_text&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/name_text&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;10dp&quot;
              android:text=&quot;@{newShoe.name}&quot;
              app:layout_constraintStart_toEndOf=&quot;@+id/name_label&quot;
              app:layout_constraintTop_toTopOf=&quot;parent&quot; /&gt;
  
          &lt;TextView
              android:id=&quot;@+id/company_text&quot;
              android:layout_width=&quot;wrap_content&quot;
              android:layout_height=&quot;wrap_content&quot;
              android:layout_marginStart=&quot;10dp&quot;
              android:text=&quot;@{newShoe.company}&quot;
              app:layout_constraintStart_toEndOf=&quot;@+id/company_label&quot;
              app:layout_constraintTop_toBottomOf=&quot;@+id/name_text&quot; /&gt;
  
      &lt;/androidx.constraintlayout.widget.ConstraintLayout&gt;
  &lt;/layout&gt;
  </code></pre>