Prerequisite

If you not understand this lecture Custom ListView in android studio .You should also read my previous lectures. Checkbox creation using android studio and Radio button using android studio. After reading these lecture you will also able to create Custom Listview of your app.

Overview

List View is widely used in Android. Android custom ListView is a view group that displays a list of scrollable items.If you have a date which is repeated in the form of  time, the list view is the best Option to use. ListView helps you in displaying repeating data in the form of a scrollable list.

Introduction

In this lecture we will describe how can create Android Custom listview.We will also describe Custom ListView description.what is ListView. why we can use it .After Reading this lecture you will understand Custom ListView in android And i hope you will create Custom ListView of your application.

Description of  Android Custom ListView

In this lecture we describe how can create custom listview in android.We will create a simple custom listview which contain three elements first elements is a picture and reaming two are text view which represent movie_title and movie string.And horizontal line are available in each row.First of all we will create a interface of of listview. And create a new project in android studio. Every project contain two file first is java class file and second is layout XML File. for more detail about android custom listview please click on android Custom listview.After that we add image into drawable folder.how can add a image Please read step 1

Step 1=Image add<-copy image->and<-paste image>into <-drawable folder->Now we add reaming two elements movie_rating and movie_Rating into string resource.So open a values folder add string resource in string.XML file.First array string is represent movie_title and second array string is represent movie_rating.

Code that are write in string .XML 

Now we open a Layout. XML file and add a list view and set height and width and also assign id to list view.In this example we are going to create a simple UI that includes only ( android custom listview ) with Different attributes.And paste the following code android custom listview into layout .XML file.

Code that are write Layout.XML 

Now you may open the Graphical layout editor to preview the User Interface you created of List view  in android.

Alt Tag list view in android

Now we create a new layout which contain three elements picture and two text view.

Now we create a New layout .XML file

Step 2=Second_layout ->Right click> the ->layout folder-> select ->New option-> and click ->layout resource folder->

Alt Tag second layout add in project

Step3=Step2->WriteName->Ok.

Alt Tag assign name to layout

Now a new layout will be add in layout folder .In a new layout first we add a image then we add text view.So open a layout.XML file add image view and set height and width.and also assign id to image view.and use a property android:src for image path.After completing this we add text view which represent movies name and set height and width and use a property android:gravity center.position at center.So we add other list text view and set the height and weight.which represent a movies rating..In this example we are going to create a simple UI that includes only (android Custom listview ) with Different attributes.And paste the following code Android Custom Listview into layout .XML file.

Code that are write in Second Layout. XML file

Now you may open the Graphical layout editor to preview the User Interface you created of Android Custom listview.So we complete a one row of android custom listview which contain one image and two listview

Alt Tag android list view image

After that we create a new class how can create a new class detail is provide at below.

Step1 = MoveDataProvider ->Right click-> the ->package name ->select ->New option-> and click-> java class that will show in below

Alt Tag create a new class

Step2=Step1->WriteName->Ok.

Alt Tag android android custom list view move data provider class

Now you open a new class MoveDataProvider and declare three variable

  • private int move_poster_resource
  • private String move_title
  • private String move_rating

After that you will add getter and  setter and using short key ALT+INS and android studio automatically add getter and setter using this key.After that we create a constructor of three parameter and pass the value.

Code that are write in MoveDataProvider .java file.

For customizing the the adapter we create a new java class how can create detail is provide step by step.

Step3 = MoveAdapter ->Right click-> the ->package name ->select ->New option-> and click-> java class that will show in below

Alt Tag create a new class

Step4=Step3->WriteName->Ok.

Alt Tag android custom listview in android

Code that are write in MoveAdapter.java file.

Now we start the coding of application.And open a MainActivity and declare a object of listview.and also declare three array. first array is used for image and second array is used for movie name and third array is used for movie rating.Code that are write in MainActivity. java class file.

Run the Application

android

Thank you  for reading this lecture Hope you got the idea.