![]() |
VOOZH | about |
ScrollView in Android allows multiple views that are places within the parent view group to be scrolled. Scrolling in the android application can be done in two ways either Vertically or Horizontally. In this article, we will be discussing how to create a Horizontal ScrollView in Kotlin.
Attribute | Description |
|---|---|
| android:fillViewport | Defines whether the ScrollView should stretch its content to fill the viewport. |
| android:measureAllChildren | Determines whether to measure all children or just those in the VISIBLE or INVISIBLE state when measuring. Defaults to false. |
| android:alpha | alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque). |
| android:background | A drawable to use as the background. |
| android:isScrollContainer | Set this if the view will serve as a scrolling container, meaning that it can be resized to shrink its overall window so that there will be space for an input method. |
| android:minHeight | Defines the minimum height of the view. |
| android:minWidth | Defines the minimum width of the view. |
| android:scrollbars | Defines which scrollbars should be displayed on scrolling or not. |
Let’s start by first creating a project in Android Studio. To do so, follow these instructions:
First step is to create a new Project in Android Studio. For this follow these steps:
We need to add some images which can be used for scrolling purpose. So, we have to copy the images from our local computer path to app/res/drawable folder.
Note: You can add the images in the mipmap folder instead of drawable folder if the size of the images is very large.