android.widget.ExpandableListAdapter.getGroupView()方法的使用及代码示例

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

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

ExpandableListAdapter.getGroupView介绍

暂无

代码示例

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

ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);

代码示例来源:origin: mttkay/calculon

private View getGroupView(int groupPosition) {
  return getAdapter().getGroupView(groupPosition, false, null, listView);
}

代码示例来源:origin: mttkay/calculon

public MultiViewAssertion groups() {
  ExpandableListAdapter adapter = getAdapter();
  int count = adapter.getGroupCount();
  List<View> views = new ArrayList<View>(count);
  for (int i = 0; i < count; i++) {
    views.add(adapter.getGroupView(i, false, null, listView));
  }
  return new MultiViewAssertion(testCase, activity, views);
}

代码示例来源:origin: xiangzhihong/gpuImage

public View getView( int flatListPos, View convertView, ViewGroup parent ) {
  final PositionMetadata posMetadata = getUnflattenedPos( flatListPos );
  View retValue;
  if( posMetadata.position.type == ExpandableHListPosition.GROUP ) {
    retValue = mExpandableListAdapter.getGroupView( posMetadata.position.groupPos, posMetadata.isExpanded(), convertView, parent );
  }
  else if( posMetadata.position.type == ExpandableHListPosition.CHILD ) {
    final boolean isLastChild = posMetadata.groupMetadata.lastChildFlPos == flatListPos;
    retValue = mExpandableListAdapter.getChildView( posMetadata.position.groupPos, posMetadata.position.childPos, isLastChild, convertView, parent );
  }
  else {
    // TODO: clean exit
    throw new RuntimeException( "Flat list position is of unknown type" );
  }
  posMetadata.recycle();
  return retValue;
}

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

View groupItem = listAdapter.getGroupView(i, false, null, list);
groupItem.measure(
    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),

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

View view = null;
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
  view = listAdapter.getGroupView(i, false, view, listView);
  if (i == 0) {
    view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));

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

private void setListViewHeight(ExpandableListView listView) {
    ExpandableListAdapter listAdapter = (ExpandableListAdapter) listView.getExpandableListAdapter();
    int totalHeight = 0;
    for (int i = 0; i < listAdapter.getGroupCount(); i++) {
      View groupView = listAdapter.getGroupView(i, true, null, listView);
      groupView.measure(0, View.MeasureSpec.UNSPECIFIED);
      totalHeight += groupView.getMeasuredHeight();

    if (listView.isGroupExpanded(i)){
      for(int j = 0; j < listAdapter.getChildrenCount(i); j++){
        View listItem = listAdapter.getChildView(i, j, false, null, listView);
        listItem.measure(0, View.MeasureSpec.UNSPECIFIED);
        totalHeight += listItem.getMeasuredHeight();
      }
    }
  }

  ViewGroup.LayoutParams params = listView.getLayoutParams();
  params.height = totalHeight
      + (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
  listView.setLayoutParams(params);
  listView.requestLayout();
}

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

View.MeasureSpec.EXACTLY);
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
  View groupItem = listAdapter.getGroupView(i, false, null, listView);
groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
totalHeight += groupItem.getMeasuredHeight();

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

View.MeasureSpec.EXACTLY);
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
  View groupItem = listAdapter.getGroupView(i, false, null, listView);
  groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
  totalHeight += groupItem.getMeasuredHeight();

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

ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);

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

View.MeasureSpec.EXACTLY);
for (int i = 0; i < listAdapter.getGroupCount(); i++) {
  View groupItem = listAdapter.getGroupView(i, false, null, listView);
  groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

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

private void setExpandableListViewHeightBasedOnChildren(ExpandableListView expandableListView, Integer expandedGroupPosition) {
  ExpandableListAdapter expandableListAdapter = expandableListView.getExpandableListAdapter();

  if (expandableListAdapter == null) {
    return;
  }

  int totalHeight = 0;
  int totalDividerHeight = 0;
  for (int i = 0; i < expandableListAdapter.getGroupCount(); i++) {
    View groupItem = expandableListAdapter.getGroupView(i, expandedGroupPosition != null, null, expandableListView);
    totalHeight += Utils.convertDpToPixel(92.42f, this);

    if(expandedGroupPosition != null && expandedGroupPosition.equals(i)) {
      for(int j=0;j<expandableListAdapter.getChildrenCount(i);j++) {
        View childItem = expandableListAdapter.getChildView(i, j, j+1==expandableListAdapter.getChildrenCount(i), null, expandableListView);
        totalHeight += Utils.convertDpToPixel(92.42f, this);
      }
      totalDividerHeight += expandableListView.getDividerHeight() * (expandableListAdapter.getChildrenCount(i)-1);
    }
  }

  totalDividerHeight += expandableListView.getDividerHeight() * (expandableListAdapter.getGroupCount()-1);
  ViewGroup.LayoutParams params = expandableListView.getLayoutParams();
  params.height = totalHeight + totalDividerHeight;
  expandableListView.setLayoutParams(params);
  expandableListView.requestLayout();
}

相关文章