ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
@Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { // Implement this method to scroll to the correct position as this doesn't // happen automatically if we override onGroupExpand() as above parent.smoothScrollToPosition(groupPosition); // Need default behaviour here otherwise group does not get expanded/collapsed // on click if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); } else { parent.expandGroup(groupPosition); } return true; }
myExpandableListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { return parent.isGroupExpanded(groupPosition); } });
expandableList.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if(groupPosition==1) return true; // This way the expander cannot be collapsed else return parent.isGroupExpanded(groupPosition); } });
expListViewObj.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if(parent.isGroupExpanded(groupPosition)) { // Do your Staff } else{ // Expanded ,Do your Staff } return false; } });
YOUR_EXP_LISTVIEW.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if(parent.isGroupExpanded(groupPosition)) { // Do your Staff } else{ // Expanded ,Do your Staff } return false; } });
mListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View clickedView, int groupPosition, long rowId) { ImageView groupIndicator = (ImageView) clickedView.findViewById(R.id.help_group_indicator); if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); groupIndicator.setImageResource(R.drawable.down_icon); } else { parent.expandGroup(groupPosition); groupIndicator.setImageResource(R.drawable.up_icon); } return true; } });
mListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View clickedView, int groupPosition, long rowId) { ImageView groupIndicator = (ImageView) clickedView.findViewById(R.id.help_group_indicator); if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); groupIndicator.setImageResource(R.drawable.down_icon); } else { parent.expandGroup(groupPosition); groupIndicator.setImageResource(R.drawable.up_icon); } return true; } });
private ArrayList<Long> getExpandedIds() { ExpandableListView list = mList; ExpandableListAdapter adapter = mAdapter; if (adapter != null) { int length = adapter.getGroupCount(); ArrayList<Long> expandedIds = new ArrayList<Long>(); for(int i=0; i < length; i++) { if(list.isGroupExpanded(i)) { expandedIds.add(adapter.getGroupId(i)); } } return expandedIds; } else { return null; } }
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if(parent.isGroupExpanded(groupPosition)){ parent.collapseGroup(groupPosition); }else{ boolean animateExpansion = false; parent.expandGroup(groupPosition,animateExpansion); } //telling the listView we have handled the group click, and don't want the default actions. return true; } });
pointcategoryExpandableList.setOnGroupClickListener(new OnGroupClickListener(){ @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { Log.d("TAG", "POSITION: "+groupPosition); if( parent.isGroupExpanded( groupPosition ) ){ parent.collapseGroup( groupPosition ); }else{ parent.expandGroup( groupPosition ); } } });
btnIndicator.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { ExpandableListView mExpandableListView = (ExpandableListView) mParetn; if(mExpandableListView.isGroupExpanded(mGroupPosition)){ mExpandableListView.collapseGroup(mGroupPosition); }else{ mExpandableListView.expandGroup(mGroupPosition); } } });
@Override public void onBackPressed() { ExpandableListView elv; boolean groupsCollapsed = false; for (int i=0; i<elv.getCount(); ++i) { if (elv.isGroupExpanded(i)) { elv.collapseGroup(i); groupsCollapsed = true; } } // If no groups collapsed, call the default back button if (!groupsCollapsed) { super.onBackPressed(); } }
public void onClick(View view) { // click - do something with item } public boolean onLongClick(View view) { // group position was stored in view tag int groupPosition = (Integer) view.getTag(); ExpandableListView listView = (ExpandableListView) findViewById(R.id.expandableListView); if (listView.isGroupExpanded(groupPosition)) listView.collapseGroup(groupPosition); else listView.expandGroup(groupPosition); return true; }
ExpandableListView accordion = (ExpandableListView) findViewById(R.id.accordion); accordion.setOnGroupClickListener(this); @Override public boolean onGroupClick(ExpandableListView paramExpandableListView, View paramView, int paramInt, long paramLong) { ImageView icon=(ImageView)paramView.findViewById(R.id.accordionIndicator); for (int i = 0; i < adapterDataCollection.size(); i++) { if (i == paramInt) { if (paramExpandableListView.isGroupExpanded(i)) { paramExpandableListView.collapseGroup(i); icon.setImageResource(R.drawable.arrow_up_np); } else { paramExpandableListView.expandGroup(i); icon.setImageResource(R.drawable.arrow_down_np); } } else { paramExpandableListView.collapseGroup(i); icon.setImageResource(R.drawable.arrow_up_np); } } paramExpandableListView.invalidate(); return true; }
expandList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if (!parent.isGroupExpanded(groupPosition)) { parent.expandGroup(groupPosition); } else { parent.collapseGroup(groupPosition); } parent.setSelectedGroup(groupPosition); return true; } });
expandList.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { if (!parent.isGroupExpanded(groupPosition)) { parent.expandGroup(groupPosition); } else { parent.collapseGroup(groupPosition); } parent.setSelectedGroup(groupPosition); return true; } });
expListView.setOnGroupClickListener(new OnGroupClickListener() { @Override public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { Log.d("onGroupClick:", "worked"); parent.smoothScrollToPosition(groupPosition); if (parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); } else { parent.expandGroup(groupPosition); } return false; } });
public void onClickInfoService(View view) { int groupPosition = (Integer) view.getTag(); if (mInfoListView.isGroupExpanded(groupPosition)) { mInfoListView.collapseGroup(groupPosition); } else { // Expand this, Collapse the rest int len = mInfoListAdapter.getGroupCount(); for (int i = 0; i < len; i++) { if (i != groupPosition) { mInfoListView.collapseGroup(i); } } mInfoListView.expandGroup(groupPosition, true); } }
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { ExpandableListAdapter itemAdapter = parent.getExpandableListAdapter(); String selectedItem = (String)itemAdapter.getChild(groupPosition, childPosition); groupHeader(selectedItem); if(parent.isGroupExpanded(groupPosition)) { parent.collapseGroup(groupPosition); } // your logic here // expandableListArrayList.add() or expandableListArrayList.remove() // or whatever itemAdapter.notifyDataSetChanged(); return true; } });