To Show or read something by scrolling we should use scrollView in android studio. This is a layout container that can host multiple component and views and can is scrollable. There are two types of scrollView.
- ScrollView - only supports vertical scrolling
- HorizontalScrollView - For horizontal scrolling
Use ScrollView Example:
-----------------------------------
<ScrollViewandroid:layout_width="wrap_content"android:layout_height="300dp"android:id="@+id/scrollView"android:paddingTop="10dp"android:paddingBottom="10dp"android:layout_marginBottom="10dp"android:scrollbars="none"><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:padding="20dp"android:textSize="25sp"android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."/><Buttonandroid:layout_width="match_parent"android:layout_height="match_parent"android:text="know more"/><Buttonandroid:layout_width="match_parent"android:layout_height="match_parent"android:text="know more"/><Buttonandroid:layout_width="match_parent"android:layout_height="match_parent"android:text="know more"/></LinearLayout></ScrollView>
ScrollView Example HorizontalScrollView example:-----------------------------------------------------------<HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="none"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello 1"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello 6"/> </LinearLayout> </HorizontalScrollView>
Comments
Post a Comment