2011-08-19 87 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; }