In this tutorial you will learn to create a custom listview android application with images and text in each list item. To display image, topic, and description in ListView we have to create a new XML file in res/layout folder and add ImageView and TextView.
To implement ListView in android, you have to work more in java activity file. ListView is a common component/layout in android application. It is difficult to make some awesome application without using listview like news app, tutorial app, social app, etc.
Android Example: How to Implement Custom ListView with Image and Text
Let’s start by creating new android project with following information.
Application name: Custom Android ListView ImageAndText Example
Company Domain: viralandroid.com
Package name: com.viralandroid.customandroidlistviewtutorialeample
Minimum SDK: Android 3.2 (API 10)
Adding ListView in XML Layout File
Open your XML layout file and add a listview. XML layout file will looks like following.
Custom ListView XML File
To add image and text in listview first you have to create a new XML layout file in res/layout/ folder. In this file I have added an ImageView two TextView with LinearLayout. Following is the complete content this file.
Java Activity File
Following is the complete java activity file where we control all thing about listview.
That’s all. Now run your Android ListView with Image and Text application, you will see lists with image, list title and short description which will look like above screenshot.