add a static editText view as the last child of a expandableListView Android
<p>I have a problem to add dynamically a static EditText, always in the last children position. My adapter uses JSON objects of type. The first time that I expand the  ExpandableListView group's children, can locate the correct position for my EditText, but when I scroll the children in the opposite direction, my EditText continually changes position. This is my Editext layout:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_height="wrap_content" 
 android:layout_width="fill_parent" 
 android:orientation="vertical" 
 android:paddingLeft="10dip"
 android:paddingRight="10dip"
 android:background="@color/lgray"&gt;
&lt;RelativeLayout android:id="@+id/feedcell_addcomment" android:paddingLeft="10dip" android:paddingRight="10dip" android:paddingTop="5dip" android:paddingBottom="5dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="1dip" android:background="@color/mlgray" &gt;


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

<p>This is my childLayout.xml</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/layoutchildren" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" android:paddingLeft="10dip" android:paddingRight="10dip" android:background="@color/lgray"&gt;
    &lt;RelativeLayout   android:paddingLeft="10dip" android:paddingRight="10dip" android:background="@color/white" android:layout_height="45dip" android:layout_width="fill_parent" android:layout_marginBottom="2dip"&gt;
        &lt;ImageView android:id="@+id/feedcommentcell_profileimg" android:layout_width="32dip" android:layout_height="32dip" android:layout_centerVertical="true" android:scaleType="fitXY"/&gt;
        &lt;TextView android:id="@+id/feedcommentcell_username" android:textStyle="bold" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="13sp" android:textColor="@color/black" android:layout_toRightOf="@+id/feedcommentcell_profileimg" android:layout_marginLeft="10dip" android:layout_alignTop="@+id/feedcommentcell_profileimg"/&gt;
        &lt;TextView android:id="@+id/feedcommentcell_comment" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="11sp" android:textColor="@color/black" android:layout_toRightOf="@+id/feedcommentcell_profileimg" android:layout_marginLeft="10dip" android:layout_below="@+id/feedcommentcell_username"/&gt;
        &lt;TextView android:id="@+id/feedcommentcell_scanhour" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="10sp" android:textColor="@color/dgray" android:layout_alignParentRight="true" android:layout_alignBottom="@+id/feedcommentcell_username"/&gt;
        &lt;/RelativeLayout&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>this is my getChildView in my adapter</p>

<pre><code> @Override
        public View getChildView(int groupPosition, int childPosition, boolean isLastChild,View convertView, ViewGroup parent)
        {

            int type=getItemViewType(groupPosition,childPosition);
            View v = convertView;
            LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            if (v == null)
            {

                switch(type)
                {

                    case TYPE_CHILD:

                        v = vi.inflate(R.layout.feedcommentcell, null);

                        break;

                    case TYPE_EDIT:

                        v = vi.inflate(R.layout.edittextcommentlist, null);
                        break;
                }

            }

            try
            { 
                if(type == TYPE_CHILD)
                {
                    JSONObject o = getChild(groupPosition,childPosition);
                        //JSONObject o = itemsChildren.get(childPosition);
                    if(o!=null)
                    {
                        TextView commentUser=(TextView)v.findViewById(R.id.feedcommentcell_username);
                        commentUser.setText(o.getString("username"));

                        String shareMessageId= o.getString("ShareMessageId");
                        o.put("ShareMessageId", shareMessageId);

                        TextView commentText=(TextView)v.findViewById(R.id.feedcommentcell_comment);
                        commentText.setText(o.getString("Message"));

                        TextView commentScanHour=(TextView)v.findViewById(R.id.feedcommentcell_scanhour);
                        commentScanHour.setText(o.getString("timestamp"));

                        ImageView commentImg=(ImageView)v.findViewById(R.id.feedcommentcell_profileimg);
                        String imgurl=o.getString("userimage");
                        if(imgurl!=null &amp;&amp; imgurl!="")
                        imageLoader.DisplayImage(imgurl, context, commentImg);

                    }

                }
                else if(type==TYPE_EDIT)
                {
                    //JSONObject o = getChild(groupPosition,childPosition);
                    JSONObject o = itemsChildren.get(childPosition);


                        o.put("edit", "false");
                        v = vi.inflate(R.layout.edittextcommentlist, null);

                    //EditText edit = (EditText) v.findViewById(R.id.feedcell_edittxt);


                }




            }
            catch(Exception e)
            {}


            return v;
        }
</code></pre>

<p>And these are the others overrides methods. I don't show you getGroupView and his layout because works properly..</p>

<pre><code>    @Override
         public JSONObject getChild(int groupPosition, int childPosition) {
                return itemsChildren.get(childPosition);
            }

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

        @Override
        public boolean areAllItemsEnabled()
        {
            return true;
        }
        @Override
        public int getChildrenCount(int groupPosition) {

            return itemsChildren.size();
        }

        @Override
        public JSONObject getGroup(int groupPosition) {
            return itemsGroup.get(groupPosition);
        }

        @Override
        public int getGroupCount() {
            return itemsGroup.size();
        }

        @Override
        public long getGroupId(int groupPosition) {
            return groupPosition;
        }
        @Override
        public boolean hasStableIds() {
            return true;
        }

        @Override
        public boolean isChildSelectable(int arg0, int arg1) {
            return true;
        }

        public boolean isTextView(int groupPosition,int childPosition)
        {
            JSONObject jo=new JSONObject();
            jo = getChild(groupPosition,childPosition);
            boolean result =false;
            try
            {
                String isEdit=jo.getString("edit");
                if(isEdit.equalsIgnoreCase("true"))
                    result=true;

            }
            catch(Exception e){}
            return result;

        }

        public int getItemViewType(int groupPosition,int childPosition) 
        {
            //JSONObject jo=getChild(groupPosition,childPosition);


            if(isTextView(groupPosition,childPosition))
                return TYPE_EDIT;
            else
                return TYPE_CHILD;
        }
</code></pre>

<p>All seems good, but editText changes the position every time...someone has some solutions?Thanks</p>
