ExpandableListView


 

  1. Static ExpandableListView
  2. Dynamic ExpandableListView
  3. ExpandableListView using ExpandableListActivity
  4. Custom ExpandableListView

 

1. Static ExpandableListView
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.
Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open AndroidManifest.xml and add following code :

ScreenShot:

expandable expandable2

Download SourceCode

 

2. Dynamic ExpandableListView
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.
Step 2 : Open src -> package -> MainActivity.java and add following code :

Step 3 : Open AndroidManifest.xml and add following code :

ScreenShot:

dy_exp dy_exp2

Download SourceCode

 

3. ExpandableListView using ExpandableListActivity
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.
Step 2 : Open src -> package -> MainActivity.java and add following code :

Step 3 : Open AndroidManifest.xml and add following code :

ScreenShot:

expandable_expalist expandable_expalist2

Download SourceCode

 

4. Custom ExpandableListView
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.
Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> Create new xml layout, group_row.xml and add following code :

Step 4 : Open res -> Create new xml layout, child_row.xml and add following code :

Step 5 : Open res -> Create new drawable xml file, expandable_selector.xml and add following code :

Step 6 : Open src -> package -> MainActivity.java and add following code :

Step 7 : Open AndroidManifest.xml and add following code :

ScreenShot:

custom_expandable custom_expandable2

Download SourceCode