How do i adjust the child size in expandablelistview on click of the child
<p>My problem is that i have made a nested expandable list view - i have used BaseExpandableListAdapter and in the getChildView() i have passed another expandableListView using convertView.Thus i successfull have a nested expandablelistView however the height of the child of the Parent expandablelistView doesn't change on opening of another expandablelistview within it.
I have used on childClickListener but of no avail.
I'm pasting my code here for reference
PLEASE HELP! please excuse the crude programming as i'm in a hurry.</p>

<p>the  code is</p>

<pre><code>    package com.TorToRaJ.tabs;


    import android.app.ExpandableListActivity;
    import android.graphics.Canvas;
    import android.os.Bundle;
    import android.view.Gravity;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.AbsListView;
    import android.widget.BaseExpandableListAdapter;
    import android.widget.ExpandableListAdapter;
    import android.widget.ExpandableListView;
    import android.widget.ExpandableListView.OnChildClickListener;
    import android.widget.ExpandableListView.OnGroupExpandListener;
    import android.widget.ImageView;
    import android.widget.TextView;

    public class NestedexplistActivity extends ExpandableListActivity implements OnChildClickListener {


ExpandableListAdapter mAdapter,cAdapter,dAdapter;
Canvas canvas;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    // Set up our adapter

    mAdapter = new MyExpandableListAdapter();
    setListAdapter(mAdapter);
    cAdapter = new MySecondExpandableListAdapter();
    dAdapter = new MyThirdExpandableListAdapter();
    getExpandableListView().setDivider(null);
    getExpandableListView().setChildDivider(null);

    getExpandableListView().setDividerHeight(0);

    //setListAdapter(cAdapter);
    OnChildClickListener c1 =new OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v,
                int groupPosition, int childPosition, long id) {
            // TODO Auto-generated method stub
             AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT,160);
             TextView textView =
                        (TextView) v.findViewById(R.id.textView1); 
            parent.updateViewLayout(v, lp);
            parent.requestLayout();

            return true;
        }
    };

    getExpandableListView().setOnChildClickListener(c1);







    registerForContextMenu(getExpandableListView());
}





/**
 * A simple adapter which maintains an ArrayList of photo resource Ids. 
 * Each photo is displayed as an image. This adapter supports clearing the
 * list of photos and adding a new photo.
 *
 */
public class MyExpandableListAdapter extends BaseExpandableListAdapter {
    // Sample data set.  children[i] contains the children (String[]) for groups[i].
    private String[] groups = { "School Test", "System Test", "Concept Test"};
    private String[][] children =new String[3][2];
    private int loop=4;
    private String bar = "██████████" ;
    private String space=" ";
    private int [] percentage ={70,60,90,100};
    public Object getChild(int groupPosition, int childPosition) {
        return children[groupPosition][childPosition];
    }

    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    public int getChildrenCount(int groupPosition) {
        return children[groupPosition].length;
    }

    public TextView getGenericView() {
        // Layout parameters for the ExpandableListView
        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,128);

        TextView textView = new TextView(NestedexplistActivity.this);
        textView.setLayoutParams(lp);
        // Center the text vertically
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        // Set the text starting position
        textView.setPadding(36, 0, 0, 0);



        return textView;
    }



    public void formdata(int gp)

    {
    int i= gp;

        while(groups[i].length() &lt; 25)
        {

            groups[i]=groups[i]+space;
        }
        int c=0;
        while(c&lt;=percentage[i])
        {
            groups[i]=groups[i]+bar;
            c=c+10;
        }
        c=110-c;
        while(c&gt;=0)
        {
            groups[i]=groups[i]+"          ";
            c=c-10;
        }
        groups[i]=groups[i]+percentage[i]+space+"%";

    }
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
           View convertView, ViewGroup parent) {
    /*   TextView textView = getGenericView();

       textView.setText(getChild(groupPosition, childPosition).toString());
       return textView;
    */

         View row = convertView;

     if(row==null){
      LayoutInflater inflater=getLayoutInflater();
      row=inflater.inflate(R.layout.custom_child, parent, false);
     }

     ExpandableListView label=(ExpandableListView)row.findViewById(R.id.expandableListView1);



     if(childPosition==0)

        label.setAdapter(cAdapter);
    else
     label.setAdapter(dAdapter);
    getExpandableListView().setDivider(null); 
    getExpandableListView().setDividerHeight(0);

    OnGroupExpandListener oge = new OnGroupExpandListener() {

        @Override
        public void onGroupExpand(int groupPosition) {

             AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                     ViewGroup.LayoutParams.MATCH_PARENT,160);
            // TODO Auto-generated method stub

        }
    };
    label.setOnGroupClickListener( new Level2GroupExpandListener( groupPosition ));
    return row;
    }



    public Object getGroup(int groupPosition) {
        return groups[groupPosition];
    }

    public int getGroupCount() {
        return groups.length;
    }

    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) {



         TextView textView = getGenericView();
         textView.setText(getGroup(groupPosition).toString());
         return textView;


    }




    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    public boolean hasStableIds() {
        return true;
    }




}


public class MySecondExpandableListAdapter extends BaseExpandableListAdapter {
    // Sample data set.  children[i] contains the children (String[]) for groups[i].
    private String[] groups = { "Average"};
    private String[][] children = {
            { "Romil", "Rikhav", "Sohil", "Dexter" }

    };
    private int loop=1;
    private String bar = "██████████" ;
    private String space=" ";
    private int [] percentage ={70};
    public Object getChild(int groupPosition, int childPosition) {
        return children[groupPosition][childPosition];
    }

    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    public int getChildrenCount(int groupPosition) {
        return children[groupPosition].length;
    }

    public TextView getGenericView() {
        // Layout parameters for the ExpandableListView
        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,48);

        TextView textView = new TextView(NestedexplistActivity.this);
        textView.setLayoutParams(lp);
        // Center the text vertically
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        // Set the text starting position
        textView.setPadding(36, 0, 0, 0);



        return textView;
    }
    public TextView getGenericView2() {
        // Layout parameters for the ExpandableListView
        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);

        TextView textView = new TextView(NestedexplistActivity.this);
        textView.setLayoutParams(lp);
        // Center the text vertically
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        // Set the text starting position
        textView.setPadding(36, 0, 0, 0);



        return textView;
    }



    public void formdata(int gp)

    {
    int i= gp;

        while(groups[i].length() &lt; 25)
        {

            groups[i]=groups[i]+space;
        }
        int c=0;
        while(c&lt;=percentage[i])
        {   

            groups[i]=groups[i]+bar;
            c=c+10;
        }
        c=110-c;
        while(c&gt;=0)
        {
            groups[i]=groups[i]+"          ";
            c=c-10;
        }
        groups[i]=groups[i]+percentage[i]+space+"%";

    }
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
           View convertView, ViewGroup parent) {
      TextView textView = getGenericView2();

       textView.setText(getChild(groupPosition, childPosition).toString());

       return textView;



    }



    public Object getGroup(int groupPosition) {
        return groups[groupPosition];
    }

    public int getGroupCount() {
        return groups.length;
    }

    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) {



         TextView textView = getGenericView();
        if(loop&gt;0)
         formdata(groupPosition);
         textView.setText(getGroup(groupPosition).toString());
         loop--;

         return textView;


    }




    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    public boolean hasStableIds() {
        return true;
    }




}


public class MyThirdExpandableListAdapter extends BaseExpandableListAdapter {
    // Sample data set.  children[i] contains the children (String[]) for groups[i].
    private String[] groups = { "Class Test 1"};
    private String[][] children = {
            { "gc1", "gc2", "gc3", "gc4" }

    };
    private int loop=1;
    private String bar = "██████████" ;
    private String space=" ";
    private int [] percentage ={80};
    public Object getChild(int groupPosition, int childPosition) {
        return children[groupPosition][childPosition];
    }

    public long getChildId(int groupPosition, int childPosition) {
        return childPosition;
    }

    public int getChildrenCount(int groupPosition) {
        return children[groupPosition].length;
    }

    public TextView getGenericView() {
        // Layout parameters for the ExpandableListView
        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,48);

        TextView textView = new TextView(NestedexplistActivity.this);
        textView.setLayoutParams(lp);
        // Center the text vertically
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        // Set the text starting position
        textView.setPadding(36, 0, 0, 0);



        return textView;
    }

    public TextView getGenericView2() {
        // Layout parameters for the ExpandableListView
        AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);

        TextView textView = new TextView(NestedexplistActivity.this);
        textView.setLayoutParams(lp);
        // Center the text vertically
        textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
        // Set the text starting position
        textView.setPadding(36, 0, 0, 0);



        return textView;
    }


    public void formdata(int gp)

    {
    int i= gp;

        while(groups[i].length() &lt; 25)
        {

            groups[i]=groups[i]+space;
        }
        int c=0;
        while(c&lt;=percentage[i])
        {
            groups[i]=groups[i]+bar;
            c=c+10;
        }
        c=110-c;
        while(c&gt;=0)
        {
            groups[i]=groups[i]+"          ";
            c=c-10;
        }
        groups[i]=groups[i]+percentage[i]+space+"%";

    }
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
           View convertView, ViewGroup parent) {
        View row = convertView;

         if(row==null){
          LayoutInflater inflater=getLayoutInflater();
          row=inflater.inflate(R.layout.custom_grandchild, parent, false);
         }

         ImageView img=(ImageView)row.findViewById(R.id.imageView1);
         img.setPivotX(new Float(0));
        // img.setPivotY(new Float(0));
         img.setScaleX(new Float(.75));
         img.setPivotY(new Float(1.0));
         img.setScaleY(new Float(0.5));
         return row;        
    }



    public Object getGroup(int groupPosition) {
        return groups[groupPosition];
    }

    public int getGroupCount() {
        return groups.length;
    }

    public long getGroupId(int groupPosition) {
        return groupPosition;
    }

    public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
            ViewGroup parent) {



         TextView textView = getGenericView();
        if(loop&gt;0)
        formdata(groupPosition);
        textView.setText(getGroup(groupPosition).toString());

        loop--;
        return textView;


    }




    public boolean isChildSelectable(int groupPosition, int childPosition) {
        return true;
    }

    public boolean hasStableIds() {
        return true;
    }




}





 class Level2GroupExpandListener implements ExpandableListView.OnGroupClickListener{
    private int level1GroupPosition;
    private ExpandableListView topExpList;
    public Level2GroupExpandListener( int level1GroupPosition ) {

        this.level1GroupPosition = level1GroupPosition;
    }

    public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
        TextView tv =(TextView)v;
     AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT,160);
        if( parent.isGroupExpanded( groupPosition ) )
            parent.collapseGroup( groupPosition );
        else
            {parent.expandGroup( groupPosition );
        parent.updateViewLayout(v,lp);
      parent.requestLayout();
            }
        return true;
    }





}
</code></pre>

<p>}</p>

<p>the xml for the customchild is</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" &gt;

    &lt;ExpandableListView
        android:id="@+id/expandableListView1"
        android:layout_width="0dp"
        android:layout_height="128dp"
        android:layout_weight="1"
        android:textColor="#0000FF"
        android:childDivider="#000000"
        android:clickable="true"
        &gt;
    &lt;/ExpandableListView&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>the xml for custom grandchild is</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:layout_gravity="left"&gt;


    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="100dp"
        android:layout_height="fill_parent"
        android:text="TextView" /&gt;

    &lt;ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_gravity="left"
        android:src="@drawable/bar" 
        android:layout_marginLeft="0dp" android:adjustViewBounds="true" android:scaleType="fitXY"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>you may add any image or modify the grandchild to run the code</p>
