Skip to main content

Posts

Showing posts from July, 2015

Simple Expandable Listview android

Expandable List View:   In this tutorial you are about to learn how to create an Expandable List view . Before getting into the tutorial we will be using a new datatype in this tutorial. You have to know about it . So here it comes, HashMap < String , List < String >> : Eg: Heading = "Animals" ; String [] child_animal = { "Lion" , "Tiger" }; HashMap < Heading , child_animal >; It is used to bind the data with the particular parent. This tells the Java compiler that the child data(Lion,Tiger) have to be placed under the heading named Animals. So Let's Start First things , first, we need three layout files. 1 Activity_main.xml:        This is where we are going to declare our Expandable list . which is as follows. <ExpandableListView android:layout_gravity= "start" android:id= "@+id/theexpandables" android:layout_width= "match_parent&