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

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

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

ExpandableListAdapter.getChildView介绍

暂无

代码示例

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

ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);

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

private View getChildView(int groupPosition, int childPosition, boolean lastChild) {
  return getAdapter().getChildView(groupPosition, childPosition, lastChild, null, listView);
}

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

public MultiViewAssertion children(int groupPosition) {
  ExpandableListAdapter adapter = getAdapter();
  int count = adapter.getChildrenCount(groupPosition);
  List<View> views = new ArrayList<View>(count);
  boolean lastChild;
  for (int i = 0; i < count; i++) {
    lastChild = isLastChild(groupPosition, i);
    views.add(adapter.getChildView(groupPosition, i, lastChild, 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 listItem = listAdapter.getChildView(i, j, false, null,
    list);
listItem.measure(MeasureSpec.makeMeasureSpec(0,

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

View listItem = null;
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  listItem = listAdapter.getChildView(i, j, false, listItem, listView);
  listItem.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, View.MeasureSpec.UNSPECIFIED));
  listItem.measure(

代码示例来源: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

|| ((!listView.isGroupExpanded(i)) && (i == group))) {
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      listView);
  listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

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

|| ((!listView.isGroupExpanded(i)) && (i == group))) {
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      listView);
  listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);

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

ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);

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

|| ((!listView.isGroupExpanded(i)) && (i == group))) {
for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      listView);
  listItem.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();
}

相关文章