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

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

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

ExpandableListView.getDividerHeight介绍

暂无

代码示例

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

int height = totalHeight + expandableListView.getDividerHeight() * (adapter.getGroupCount() - 1);

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

height += list.getDividerHeight() * (list.getCount() - 1);
Log.i("height", "" + height);
return height;

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

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

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

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

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

+ (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
if (height < 10)
  height = 200;

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

+ (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
if (height < 10)
  height = 200;

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

+ (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1));
if (height < 10)
  height = 200;

代码示例来源:origin: doc-rj/smartcard-reader

dummyView.setDivider(listView.getDivider(), parent.getMeasuredWidth(), listView.getDividerHeight());

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

dummyView.setDivider(listView.getDivider(), parent.getMeasuredWidth(), listView.getDividerHeight());

代码示例来源:origin: lucid-lynxz/BlogSamples

dummyView.setDivider(listView.getDivider(), parent.getMeasuredWidth(), listView.getDividerHeight());

相关文章

ExpandableListView类方法