![]() |
VOOZH | about |
For understanding horizontal ListView in android, first, we have to know about list view in android. ListView is scrollable collection of views, where each view is positioned immediately below the previous view in the list. This can be implemented using RecyclerView.
A Horizontal ListView is a type of view in which many views are there and all the available views are scrollable horizontally. Each view is places by side of another view. This can be implemented by HorizontalScrollView. A sample video is given below to get an idea about what we are going to do in this article.
Note: This Android article covered in both Java and Kotlin languages.
Step 1: Create a New Project in Android Studio
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. The code for that has been given in both Java and Kotlin Programming Language for Android.
Step 2: Working with activity_main.xml
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
Step 3: Working with the MainActivity File
Go to the MainActivity File and refer to the following code. Below is the code for the MainActivity File. Comments are added inside the code to understand the code in more detail.
Output: