Android ListView in Kotlin Last Updated : 12 Jul, 2025 Comments Improve Suggest changes 16 Likes Like Report ListView in Android is a ViewGroup which is used to display a scrollable list of items arranged in multiple rows. It is attached to an adapter which dynamically inserts the items into the list. The main purpose of the adapter is to retrieve data from an array or a database and efficiently push every elements into the list for a desired result.In this article, we will learn how to use ListView of Android in Kotlin.Android AdapterThe adapter holds the data fetched from an array and iterates through each item in the data set and generates the respective views for each item of the list. So, we can say it act as an intermediate between the data sources and adapter views such as ListView, and GridView. Types of AdaptersDifferent Types of Adapter are mentioned below:Adapter TypeDescriptionArrayAdapterIt always accepts an Array or List as input. We can store the list items in the strings.xml file also.CursorAdapterIt always accepts an instance of the cursor as an input means SimpleAdapterIt mainly accepts static data defined in the resources like arrays or databases.BaseAdapterIt is a generic implementation for all three adapter types and it can be used in the views according to our requirements.Some Important XML Attributes of ListViewAttributeDescription android:dividerA color or drawable to separate list items.android:dividerHeightDivider's height.android:entriesReference to an array resource that will populate the ListView.android:footerDividersEnabledWhen set to false, the ListView will not draw the divider before each footer view.android:headerDividersEnabledWhen set to false, the ListView will not draw the divider before each header view.Now, we going to create an Android application, using an array adapter. Open an activity_main.xml file from \res\layout path and write the code like as shown below. When we have created layout, we need to load the XML layout resource from our activity onCreate() callback method and access the UI element form the XML using findViewById(). MainActivity.kt package org.geeksforgeeks.demo import android.os.Bundle import android.widget.ArrayAdapter import android.widget.ListView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { private lateinit var listView: ListView override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // use ArrayAdapter and define an array val arrayAdapter: ArrayAdapter<*> val users = arrayOf( "Python", "Java", "C++", "PHP", "Kotlin", "GoLang", "SQL", "R Language", "Android", "Git", "AWS", "Docker", "Azure", "GCP", "JavaScript", "TypeScript" ) // access the listView from xml file listView = findViewById(R.id.user_list) arrayAdapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, users) listView.adapter = arrayAdapter } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" tools:context=".MainActivity"> <ListView android:id="@+id/user_list" android:layout_marginTop="32dp" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"/> </androidx.constraintlayout.widget.ConstraintLayout> Output:This is the expected output from the above code: Click Here to Learn More about Android Application Development with Kotlin Create Quiz Comment P Praveenruhil Follow 16 Improve P Praveenruhil Follow 16 Improve Article Tags : Android Kotlin Android Android-View Explore BasicsIntroduction to Android Development 5 min read History of Android 15+ min read Best Way to Become Android Developer â A Complete Roadmap 7 min read Android Development Prerequisites [2025] - Things to Learn Before Android Development 8 min read Android App Development Fundamentals for Beginners 6 min read Android Architecture 5 min read Android System Architecture 3 min read Android Boot Process 4 min read Difference between Java and Kotlin in Android with Examples 3 min read Interesting Facts About Android 3 min read Software Setup and ConfigurationDownload and Install JDK on Windows, Mac and Linux 6 min read Guide to Install and Setup IntelliJ IDEA for Android App Development 5 min read Guide to Install and Setup Visual Studio for Android App Development 4 min read How to Run the Android App on a Real Device? 2 min read Resolving frequently occurring errors in Android Development 3 min read Android Studio Tutorial 9 min read File Structure & ComponentsComponents of an Android Application 3 min read Introduction to Activities in Android 6 min read Services in Android with Example 10 min read Core TopicsHow Does Android App Work? 7 min read Activity Lifecycle in Android with Demo App 9 min read Introduction to Gradle 4 min read What is Context in Android? 9 min read Bundle in Android with Example 6 min read Activity State Changes In Android with Example 6 min read Processes and Application Lifecycle in Android 7 min read Desugaring in Android 4 min read Difference Between AndroidX and Android Support Libraries 3 min read Memory Leaks in Android 7 min read Layout & ViewLayouts in Android UI Design 3 min read Android UI Layouts 5 min read LinearLayout and its Important Attributes with Examples in Android 3 min read Android LinearLayout in Kotlin 2 min read Android RelativeLayout in Kotlin 4 min read ConstraintLayout in Android 6 min read TextView widget in Android with Examples 5 min read TextView in Kotlin 3 min read Working With the TextView in Android 7 min read Autosizing TextView in Android 6 min read ButtonButton in Android 3 min read How to Add Radio Buttons in an Android Application? 5 min read RadioButton in Kotlin 4 min read How to add Toggle Button in an Android Application 3 min read ToggleButton in Kotlin 2 min read RadioGroup in Kotlin 3 min read Intent and Intent FiltersWhat is Intent in Android? 4 min read Implicit and Explicit Intents in Android with Examples 6 min read How to Send Data From One Activity to Second Activity in Android? 7 min read How to open dialer in Android through Intent? 3 min read Creating Multiple Screen Applications in Android 6 min read How to Open Camera Through Intent and Display Captured Image in Android? 6 min read Toast & RecyclerViewToasts for Android Studio 2 min read What is Toast and How to Use it in Android with Examples? 6 min read Android Toast in Kotlin 3 min read How to Change Toast font in Android? 3 min read How to add a custom styled Toast in Android 4 min read RecyclerView in Android with Example 7 min read Android | Horizontal RecyclerView with Examples 4 min read How to create a nested RecyclerView in Android 5 min read How to Create RecyclerView with Multiple ViewType in Android? 6 min read RecyclerView using ListView in Android With Example 5 min read Fragments & AdaptersIntroduction to Fragments | Android 5 min read Fragment Lifecycle in Android 8 min read How to Create a New Fragment in Android Studio? 2 min read How to Create Swipe Navigation in Android? 6 min read ViewPager Using Fragments in Android with Example 6 min read ArrayAdapter in Android with Example 3 min read SimpleAdapter in Android with Example 7 min read SimpleExpandableListAdapter in Android with Example 10 min read AdapterViewFlipper in Android with Example 5 min read BaseExpandableListAdapter in Android with Example 10 min read Like