Android ListView is a view which contains the group of items and displays in a scrollable list. ListView is implemented by importing android.widget.ListView class. ListView is a default scrollable which does not use other scroll view.
ListView uses Adapter classes which add the content from data source (such as string array, array, database etc) to ListView. Adapter bridges data between an AdapterViews and other Views (ListView, ScrollView etc).
Example of ListView
Let’s implement a simple listview example.
Structure of listview project
First we need to drag and drop ListView component from palette to activity_main.xml file.
Create an additional mylist.xml file in layout folder which contains view components displayed in listview.
Now place the list of data in strings.xml file by creating string-array.
In java class we need to add adapter to listview using setAdapter() method of listview.
Leave A Comment