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

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

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

ExpandableListAdapter.getChildrenCount介绍

暂无

代码示例

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

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

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

private boolean isLastChild(int groupPosition, int childPosition) {
  return (childPosition == getAdapter().getChildrenCount(groupPosition) - 1);
}

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

/**
 * Adds new items when adapter is modified
 */
public void resetItems() {
  ExpandableListAdapter adp=swipeListView.getExpandableListAdapter();
  if (adp != null) {
    int count = 0;
    for (int i=0; i<adp.getGroupCount();i++){
      //Add the total children and the group itself.
      count+=adp.getChildrenCount(i) + 1;
    }
    for (int i = opened.size(); i <= count; i++) {
      opened.add(false);
      openedRight.add(false);
      checked.add(false);
    }
  }
}

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

System.out.println("Save clicked");
for(int i = 0; i < listAdapter.getGroupCount();i++) {
  for (int k = 0; k < listAdapter.getChildrenCount(i); k++) {

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

gChildrenCount = mExpandableListAdapter.getChildrenCount( curGm.gPos );

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

public ViewAssertion lastChild(int groupPosition) {
  return child(getAdapter().getGroupCount() - 1, getAdapter().getChildrenCount(groupPosition) - 1);
}

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

for (int j = 0; j <listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      list);

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

if(((listView.isGroupExpanded(i)) && (i != group)) || ((!listView.isGroupExpanded(i)) && (i == group))) {
  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));

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

@Override
  public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    Log.i(Constants.TAG, "Launching TaskDetailActivity from ProjectTasksFragment.");
    MainActivity mainActivity = (MainActivity) getActivity();
    if (childPosition == parent.getExpandableListAdapter().getChildrenCount(groupPosition) - 1){
      Intent intent = new Intent(getContext(), TaskEditActivity.class);
      intent.putExtra("columnid", mColumn.getId());
      intent.putExtra("projectid", ((MainActivity) getActivity()).getProject().getId());
      intent.putExtra("swimlaneid", ((MainActivity) getActivity()).getProject().getSwimlanes().get(groupPosition).getId());
      intent.putExtra("projectusers", (Hashtable<Integer, String>) mainActivity.getProject().getProjectUsers());
      startActivityForResult(intent, Constants.RequestEditTask);
      return true;
    }
    KanboardProject project = ((MainActivity) getActivity()).getProject();
    KanboardTask clickedTask = project.getGroupedActiveTasks().get(mColumn.getId()).get(project.getSwimlanes().get(groupPosition).getId()).get(childPosition);
    Intent taskIntent = new Intent(getContext(), TaskDetailActivity.class);
    taskIntent.putExtra("task", clickedTask);
    taskIntent.putExtra("me", ((MainActivity)getActivity()).getMe());
    taskIntent.putExtra("column", mColumn);
    taskIntent.putExtra("swimlane", project.getSwimlanes().get(groupPosition));
    if (clickedTask.getCategoryId() > 0)
      taskIntent.putExtra("category", project.getCategoryHashtable().get(clickedTask.getCategoryId()));
    startActivityForResult(taskIntent, Constants.RequestEditTask);
    return true;
  }
});

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

for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      listView);

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

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

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

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

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

for (int j = 0; j < listAdapter.getChildrenCount(i); j++) {
  View listItem = listAdapter.getChildView(i, j, false, null,
      listView);

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

/**
 * Expand a group in the grouped list view
 *
 * @param groupPos the group to be expanded
 * @param animate  true if the expanding group should be animated in
 * @return True if the group was expanded, false otherwise (if the group
 * was already expanded, this will return false)
 */
public boolean expandGroup( int groupPos, boolean animate ) {
  ExpandableHListPosition elGroupPos = ExpandableHListPosition.obtain( ExpandableHListPosition.GROUP, groupPos, - 1, - 1 );
  ExpandableHListConnector.PositionMetadata pm = mConnector.getFlattenedPos( elGroupPos );
  elGroupPos.recycle();
  boolean retValue = mConnector.expandGroup( pm );
  if( mOnGroupExpandListener != null ) {
    mOnGroupExpandListener.onGroupExpand( groupPos );
  }
  if( animate ) {
    final int groupFlatPos = pm.position.flatListPos;
    final int shiftedGroupPosition = groupFlatPos + getHeaderViewsCount();
    smoothScrollToPosition( shiftedGroupPosition + mAdapter.getChildrenCount( groupPos ), shiftedGroupPosition );
  }
  pm.recycle();
  return retValue;
}

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

smoothScrollToPosition( shiftedGroupPosition + mAdapter.getChildrenCount( groupPos ), shiftedGroupPosition );

相关文章