本文整理了Java中android.widget.ExpandableListView.setLayoutParams()
方法的一些代码示例,展示了ExpandableListView.setLayoutParams()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ExpandableListView.setLayoutParams()
方法的具体详情如下:
包路径:android.widget.ExpandableListView
类名称:ExpandableListView
方法名:setLayoutParams
暂无
代码示例来源:origin: stackoverflow.com
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
convertView = inflater.inflate(R.layout.catitem, parent, false);
TextView textView_catName = (TextView)convertView.findViewById(R.id.textView_catName);
Category current = categories.get(groupPosition).childs.get(childPosition);
textView_catName.setText(groupPosition + " , " + childPosition);
if(current.childs.size() > 0 ) {
ExpandableListView elv = new ExpandableListView(context);
elv.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT));
elv.setAdapter(new CatAdapter(context, current.childs));
((ViewGroup)convertView).addView(elv);
}
return convertView;
}
代码示例来源:origin: stackoverflow.com
height = 100;
params.height = height;
expandableListView.setLayoutParams(params);
expandableListView.requestLayout();
代码示例来源:origin: stackoverflow.com
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
height = 200;
params.height = height;
listView.setLayoutParams(params);
listView.requestLayout();
代码示例来源:origin: stackoverflow.com
height = 200;
params.height = height;
listView.setLayoutParams(params);
listView.requestLayout();
代码示例来源:origin: stackoverflow.com
height = 200;
params.height = height;
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: louisgeek/LouisShopCart
lp.setMargins(0, top, 0, r_height);//48
expandableListView.setLayoutParams(lp);
内容来源于网络,如有侵权,请联系作者删除!