android.widget.ExpandableListView.expandGroup()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中android.widget.ExpandableListView.expandGroup()方法的一些代码示例,展示了ExpandableListView.expandGroup()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListView.expandGroup()方法的具体详情如下:
包路径:android.widget.ExpandableListView
类名称:ExpandableListView
方法名:expandGroup

ExpandableListView.expandGroup介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

ExpandableListView Exlist;

Exlist.expandGroup(0);
Exlist.expandGroup(1);

代码示例来源:origin: stackoverflow.com

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
  View v = super.getGroupView(groupPosition, isExpanded, convertView, parent);
  ExpandableListView eLV = (ExpandableListView) parent;
  eLV.expandGroup(groupPosition);
  return v;
}

代码示例来源:origin: stackoverflow.com

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
  View v = super.getGroupView(groupPosition, isExpanded, convertView, parent);
  ExpandableListView mExpandableListView = (ExpandableListView) parent;
  mExpandableListView.expandGroup(groupPosition);
  return v;
}

代码示例来源:origin: stackoverflow.com

forumListView.setOnGroupClickListener(new OnGroupClickListener() {
 @Override
 public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
     Log.d("onGroupClick:", "worked");
     parent.expandGroup(groupPosition);
     return false;
   }
 });

代码示例来源:origin: stackoverflow.com

ExpandableListView mExpandableListView = (ExpandableListView) parent;
mExpandableListView.expandGroup(groupPosition);

代码示例来源:origin: stackoverflow.com

ExpandableListView elv = (ExpandableListView) findViewById(R.id.elv_main);
elv.setAdapter(adapter);
for(int i=0; i < adapter.getGroupCount(); i++)
  elv.expandGroup(i);

代码示例来源:origin: cSploit/android

public synchronized void addChild(String group, String child) {
  if (mGroups.get(group) == null)
    addGroup(group);
  mGroups.get(group).add(child);
  Object[] keys = mGroups.keySet().toArray();
  int groups = keys.length;
  for (int i = 0; i < groups; i++) {
    if (keys[i].toString().equals(group)) {
      mListView.expandGroup(i);
      break;
    }
  }
  notifyDataSetChanged();
}

代码示例来源:origin: androidquery/androidquery

public T expand(int position, boolean expand){
  
  if(view instanceof ExpandableListView){
    
    ExpandableListView elv = (ExpandableListView) view;
    if(expand){
      elv.expandGroup(position);
    }else{
      elv.collapseGroup(position);
    }
  }
  
  return self();
}

代码示例来源:origin: androidquery/androidquery

public T expand(boolean expand){
  
  if(view instanceof ExpandableListView){
    
    ExpandableListView elv = (ExpandableListView) view;            
    ExpandableListAdapter ela = elv.getExpandableListAdapter();
    
    if(ela != null){
      
      int count = ela.getGroupCount();
      
      for(int i = 0; i < count; i++){
        if(expand){
          elv.expandGroup(i);
        }else{
          elv.collapseGroup(i);
        }
      }
      
    }
    
      
  }
  
  return self();
}

代码示例来源:origin: H07000223/FlycoDialog_Master

@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.ac_dialog_home);
  ButterKnife.bind(this);
  mMenuItems.add(new DialogMenuItem("收藏", R.mipmap.ic_winstyle_favor));
  mMenuItems.add(new DialogMenuItem("下载", R.mipmap.ic_winstyle_download));
  mMenuItems.add(new DialogMenuItem("分享", R.mipmap.ic_winstyle_share));
  mMenuItems.add(new DialogMenuItem("删除", R.mipmap.ic_winstyle_delete));
  mMenuItems.add(new DialogMenuItem("歌手", R.mipmap.ic_winstyle_artist));
  mMenuItems.add(new DialogMenuItem("专辑", R.mipmap.ic_winstyle_album));
  mBasIn = new BounceTopEnter();
  mBasOut = new SlideBottomExit();
  View decorView = getWindow().getDecorView();
  HomeAdapter adapter = new HomeAdapter(mContext);
  mElv.setAdapter(adapter);
  // extend all group
  for (int i = 0; i < mGroups.length; i++) {
    mElv.expandGroup(i);
  }
  mElv.setOnChildClickListener(this);
  mElv.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
    @Override
    public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
      return true;
    }
  });
}

代码示例来源:origin: stackoverflow.com

@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;
}

代码示例来源:origin: stackoverflow.com

@Override
 public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
   View view = super.getGroupView(groupPosition, isExpanded, convertView, parent);
   ExpandableListView list = (ExpandableListView) parent;
   list.expandGroup(groupPosition);
   return view;
 }

代码示例来源:origin: stackoverflow.com

@Override
 View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup     parent) {
   View v = super.getGroupView(groupPosition, isExpanded, convertView, parent);
   ExpandableListView eLV = (ExpandableListView) parent;
   eLV.expandGroup(groupPosition);
   return v;
}

代码示例来源:origin: jclehner/rxdroid

private void expandAllInternal(/*boolean animate*/)
  {
    for(int i = 0; i != mAdapter.getGroupCount(); ++i)
    {
      if(Version.SDK_IS_JELLYBEAN_OR_NEWER)
        mList.expandGroup(i /*, animate*/);
      else
        mList.expandGroup(i);
    }
  }
}

代码示例来源:origin: com.googlecode.android-query/android-query

public T expand(int position, boolean expand){
  
  if(view instanceof ExpandableListView){
    
    ExpandableListView elv = (ExpandableListView) view;
    if(expand){
      elv.expandGroup(position);
    }else{
      elv.collapseGroup(position);
    }
  }
  
  return self();
}

代码示例来源:origin: stackoverflow.com

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 );
       }
     }
   });

代码示例来源:origin: andresth/Kandroid

@Override
  public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectTaskFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
      lv.expandGroup(i);
  }
}

代码示例来源:origin: andresth/Kandroid

@Override
  public void onResume() {
    super.onResume();
    assert getView() != null : "ProjectInactiveTasksFragment: getView() returned null";
    ExpandableListView lv = (ExpandableListView) getView().findViewById(R.id.expandable_list);
    for (int i = 0; i < lv.getExpandableListAdapter().getGroupCount(); i++)
      lv.expandGroup(i);
  }
}

代码示例来源:origin: stackoverflow.com

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;
   }
 });

代码示例来源:origin: derry/delion

@Override
public void onUpdated() {
  mAdapter.notifyDataSetChanged();
  for (int i = 0; i < mAdapter.getGroupCount(); i++) {
    if (mAdapter.getGroup(i).isCollapsed()) {
      mListView.collapseGroup(i);
    } else {
      mListView.expandGroup(i);
    }
  }
  mSnapshotContentChanged = true;
}

相关文章

ExpandableListView类方法