How can I avoid "IllegalStateException: Scrollview can host only one direct child"?
You have added more than one controls as children of a ScrollView
. If you want to do this add a LinearLayout
as a direct child and put the other controls in it.
You can avoid IllegalStateException :Scollview can host only one direct child
by only hosting one direct child in your scrollview
My problem with same exception was that I tried to show a Snackbar warning to user with a view as a parameter to show it. That view was inside scrollview, and it was breaking the hierarchy somehow. When i switched back to Toast, exception gone away.