The world of development
If you want to become a
good developer then you
must understand the hierarchy of the views. Here we have one most important topic to discuss with you and which is based on the
scroller view. So let’s learn the scroller view hierarchy.
android.widget.ScrollView class provides the functionality of
ScrollView is used to scroll the child elements of palette inside
vertical scroll view as default scroll view.
Vertical ScrollView scrolls elements vertically. And Android uses
HorizontalScrollView for horizontal ScrollView.
Basically, for any scrolling area, we have the
scroller view. Here I am going to tell the hierarchy of scroller view.
<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!--Any others layout will come inside that--> </LinearLayout> </ScrollView> </android.support.constraint.ConstraintLayout>
Why it's happened, As per my study and my experience we cannot take multiple child views for a single scroller view.
Why? Because if you will take multiple child views into the scroller view then the
compiler will get
generate the output. Because if scroller view has the
single child then it’s
clear for the
compiler that scroller will scroll that single view. And this methodology is applicable to both scroller view. Both, I mean to say HorizontalScrollerview and ScrollerView.