Android Linear ListView Example

ListView is one of the important and widely used android UI component/widget. To display multiple similar data on android we use listview. Linear ListView is also similar concept to listview. It is used instead of listview. You can customize linear listview according to your needs. Using linear listview you can also make horizontal and vertical list item by setting attributes in XML layout file.

In this tutorial, you will learn to implement linear listview in your android application and to set onClick listener. If you have already used list view in any android app/game, it is easy for you working with linear listview layout. Linear listview allows you to bind a linear layout with a ListAdapter.

Floating Action Button (FAB) with Android ListView
Android ListView with Image and Text
Simple Android ListView Example

Android Example: How to Add/Implement Linear ListView in Android

Let’s start to implement linear listview in android app by adding compile 'com.github.frankiesardo:linearlistview:1.0.1@aar' dependencies in build.gradle file. Build.gradle file will look like below.


Open your app XML layout file and add com.linearlistview.LinearListView widget in your layout file inside scrollview. Following is the complete content of XML layout file.


Again create a new XML layout file for list item and add text view with an id, which will look like below.


Now we are working with java code, here we will control on list item click and list adapter. Open java activity file and add following code.


Android Example: How to Add/Implement Linear ListView in Android

That’s all. Run your Android Linear ListView Example application which will look like above screenshot.
UI 5881486986338918556
Home item