2011-08-19 51 views
0
public class ExpAdapter extends BaseExpandableListAdapter { 



    private Context myContext; 
     public ExpAdapter(Context context) { 
     myContext = context; 
     } 
     public Object getChild(int groupPosition, int childPosition) { 
     return null; 
     } 

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

     public View getChildView(int groupPosition, int childPosition, 
     boolean isLastChild, View convertView, ViewGroup parent) { 

     if (convertView == null) { 
     LayoutInflater inflater = (LayoutInflater) myContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     convertView = inflater.inflate(R.layout.mainscreenadvandprochlidrow, null); 
     } 

我已经使用BaseExpandableListAdapterExpandListview问题在android系统

自定义扩展列表视图中添加编辑文本到组,有它的子节点......现在,当我点击组指标..它不会扩展与其子节点...如果我从编组删除编辑ext扩展...现在我编辑文本焦点能够部分错误...列表视图扩展,直到我点击编辑文本...什么是首选的解决方案?

+0

我认为这将真正帮助您http://groups.google.com/group/android-developers/browse_thread/thread/50f0fc185da8fe4d?pli=1 – Nitin

+0

我想要一个解决方案 – Rockin

回答

0

在您的活动: expandlist.setPressed(false); (expandlist是您自定义的可扩展列表视图)
ExpAdapter expAdapter = new ExpAdapter(context); expAdapter.ExpandableListView(expandlist);

在ExpAdapter

,加上这样的:

public class ExpAdapter extends BaseExpandableListAdapter { 

私人ExpandableListView expandlist; private ExpandableListView expandlist;

public void setExpandableListView(ExpandableListView expandlist){ 
    this.expandlist = expandlist; 
    } 


@Override 
public View getGroupView(final int groupPosition, boolean isExpanded,  View convertView, ViewGroup parent) {convertView.setOnClickListener(new View.OnClickListener() { 
     @Override 
     public void onClick(View v) { 
      if(!isExpanded){ 
       expandlist.collapseGroup(groupPosition) 
      }else{ 
       expandlist.expandGroup(groupPosition); 
      } 
     } 
    }); 

return convertView; }