0

I am new to Android Development and learning ViewGroups. So, I found it very strange that why we can't add more than one direct view or viewGroups in scrollview?

Shoaib Kakal
  • 1,090
  • 2
  • 16
  • 32

1 Answers1

1

Well why not add one viewgroup like (LinearLayout) to your scrollView and then add the views into this viewgroup.

You can always use a RecyclerView which is the best approach for different view types in a list.

Hasan Bou Taam
  • 4,017
  • 2
  • 12
  • 22
  • Yes, we can do it by one `LinearLayout` but again why we are restricted to use only one view or ViewGroup?.I only need a textView to show long paragraphs and a comment button at the end So, here using RecyclerView makes no sense. – Shoaib Kakal Apr 18 '20 at 14:59
  • Does the button have to be part of the scroll list? – Hasan Bou Taam Apr 18 '20 at 15:00
  • You can use a FrameLayout, where the scrollview having only textview is added first and then on top of that add the button such that it is at the end (so the button float on the scroll view). – Hasan Bou Taam Apr 18 '20 at 15:02
  • But I don't why not just include a linear layout inside the scroll view? – Hasan Bou Taam Apr 18 '20 at 15:03