--ADVERTISEMENT--

In this example, I am going to show how to create a ListView in android. To create lists you have to add ListView in your xml layout and create a new layout and add TextView.

Related:
Android Material Design with Design Support Library
Android WebView Tutorial with Example
How to Share Android Studio Project on GitHub

Create a new Android Project


Application Name: Android ListView Example
Company Domain: viralandroid.com
Package Name: com.viralandroid.androidlistviewexample
Minimum SDK: Android 2.2 (API 8 Froyo)

XML Main Layout File


In your main layout add ListView which looks like this.
res/layout/activity_main.xml

XML ListView Row Layout File


Following is the xml code of listview_row.xml file.
res/layout/listview_row.xml

Java Activity File


Following is the modified java code of MainActivity.java file.
src/MainActivity.java


Strings.xml File


res/values/strings.xml

Now, run your application which looks like this.

Android ListView Example
Android ListView

Download Complete Example Project

Download complete Android ListView Example project source code from GitHub.

Post a Comment

Powered by Blogger.