android - EditText inside ExpandableListView is not expanding the childs -


i have created expandablelistview following tutorial http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ working fine. there have 2 textview in parent group. when adding edittext in parent group it's showing in listview after clicking on parent it's not expanding. assume it's due focus on edittext.

please find way focus on parent item clicking expands , shows child items. on other hand when try write in edittext should focus on without expanding listview.

here code:

package com.sifb.icms.sit.application.adapter;  import java.util.arraylist; import java.util.hashmap; import java.util.list;  import com.sifb.icms.sit.r; import com.sifb.icms.sit.object.object_cateringmenu;  import android.content.context; import android.graphics.color; import android.graphics.typeface; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.widget.baseexpandablelistadapter; import android.widget.edittext; import android.widget.textview;  public class expandablelistadapter_cateringmenu extends baseexpandablelistadapter {      private context _context;     private list<object_cateringmenu> _listdataheader; // header titles     // child data in format of header title, child title     private hashmap<string, string> _listdatachild;      public expandablelistadapter_cateringmenu(context context, arraylist<object_cateringmenu> listdataheader,             hashmap<string, string> listchilddata) {         this._context = context;         this._listdataheader = listdataheader;         this._listdatachild = listchilddata;     }      @override     public object getchild(int groupposition, int childposititon) {         return this._listdatachild.get(this._listdataheader.get(groupposition).getcategorychoice());     }      @override     public long getchildid(int groupposition, int childposition) {         return childposition;     }      @override     public view getchildview(int groupposition, final int childposition,             boolean islastchild, view convertview, viewgroup parent) {          final string childtext = (string) getchild(groupposition, childposition);          if (convertview == null) {             layoutinflater infalinflater = (layoutinflater) this._context                     .getsystemservice(context.layout_inflater_service);             convertview = infalinflater.inflate(r.layout.list_cateringmenu_description, null);         }          textview txtlistchild = (textview) convertview                 .findviewbyid(r.id.tvdescription);          txtlistchild.settext(childtext);         return convertview;     }      @override     public int getchildrencount(int groupposition) {         return 1;     }      @override     public object getgroup(int groupposition) {         return this._listdataheader.get(groupposition);     }      @override     public int getgroupcount() {         return this._listdataheader.size();     }      @override     public long getgroupid(int groupposition) {         return groupposition;     }      @override     public view getgroupview(int groupposition, boolean isexpanded,             view convertview, viewgroup parent) {         object_cateringmenu objgroup = (object_cateringmenu) getgroup(groupposition);         if (convertview == null) {             layoutinflater infalinflater = (layoutinflater) this._context                     .getsystemservice(context.layout_inflater_service);             convertview = infalinflater.inflate(r.layout.list_cateringmenu, null);         }          textview lbllistheadercat = (textview) convertview                 .findviewbyid(r.id.tvcategorychoice);         lbllistheadercat.settypeface(null, typeface.bold);         lbllistheadercat.settext(objgroup.getcategorychoice());          textview lbllistheaderratio = (textview) convertview                 .findviewbyid(r.id.tvratio);         lbllistheaderratio.settypeface(null, typeface.bold);         lbllistheaderratio.settext(objgroup.getratio());          return convertview;     }      @override     public boolean hasstableids() {         return false;     }      @override     public boolean ischildselectable(int groupposition, int childposition) {         return true;     }  } 

layout

    <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/svparent"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:orientation="vertical" >      <textview         android:id="@+id/tvtitle"         style="@style/tvtitletext"         android:text="@string/cateringmenu_title" />      <include         android:id="@+id/include_cateringmenu_header"         layout="@layout/list_cateringmenu_header" />      <expandablelistview         android:id="@+id/elvcateringmenu"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:groupindicator="@android:color/transparent"         android:descendantfocusability="beforedescendants"         android:layout_margintop="10dp" />  </linearlayout> 

parent listview

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/rlparent"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="horizontal"     android:weightsum="1" >      <textview         android:id="@+id/tvcategorychoice"         style="@style/tvcateringmenu"         android:layout_marginleft="10dp"         android:layout_marginright="20dp"         android:layout_weight="0.5" />      <textview         android:id="@+id/tvratio"         style="@style/tvcateringmenu"         android:layout_weight="0.2" />      <edittext         android:id="@+id/etmealuplift"         style="@style/etcateringmenumealuplift"         android:layout_weight="0.3" />  </linearlayout> 


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -