how to add Multi Column List in android

0 2,826

Android Multicolumn Listview

In this tutorial, I will show you how you can add Android Multicolumn Listview using the custom adapter.

Listview

A listview is a group of items in a list which is a scrollable list to display our data in a list format.

So why we need multi column list?

Sometimes we need to display our data in table format like student roll number age group class like an HTML table in a web.so in this tut we will add data in list to display in multiple columns lets starts 😉

MainActivity.java

Here is MainActivity.java ,in MainActivity we have used hashmap to pass our app data to listview .we have defined HashMap object which takes two Strings and put method assign data to listview

ListViewAdapter.java

We have implement custom adapter to pass our data into multiple columns The adapter helps to inflate the layout. In class ListViewAdapter.java we extend ListViewAdapter with BaseAdapter “ListViewAdapter extends BaseAdapter”

colmn_row.XML

to create multiple custom columns we have implemented four text view in colmn_row.xml layout

activity_main.xml

in activity_main.xml layout we have a ListView to display our multi columns list data in multiple coulmns

Download  Multi Column List source code

 

 

Comments

comments

Leave A Reply

Your email address will not be published.