Android ListView

In this tutorial you will learn about the Android ListView and its application with practical example.

Android ListView

ListView is a view from which we can display group of items in vertical scrollable list. List items are automatically inserted with the help of adapter.
Adapter is a bridge UI component and data source, It pulls data from database or an array.

Table Of Contents

Lets understand ListView by an example, Create an project for ListView and define ListView in xml like below code:

ListView Attributes:

Width : Used for giving Width of ListView.

Height : Used for giving Height of ListView.

ID : It uniquely identify the View.

Divider : It can be drawable or color which drawn between listview item.

Divider Height : This is the height of divider.

Let see how your layout will look after draw ListView .

1

Now Its time to move on Activity Coding Part :

So here is the code for ListView , I have used String Array which is bind with an ArrayAdapter, As we discussed above that Adapter is used to pull data from Database or an Array, So here is the example of ArrayAdapter which is pulling data from String array and then set into ListView.
ArrayAdapter is used when your data source is in array format.

Screenshot_20170826-234147

In above image you can see your created list. So its simple ListView in which we used an ArrayAdapter . In next module we will learn Custom ListView using BaseAdapter.

In this tutorial we have learn about the Android ListView and its application with practical example. I hope you will like this tutorial.