本文整理了Java中android.widget.ListView.measure()
方法的一些代码示例,展示了ListView.measure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ListView.measure()
方法的具体详情如下:
包路径:android.widget.ListView
类名称:ListView
方法名:measure
暂无
代码示例来源:origin: arcadefire/nice-spinner
private void measurePopUpDimension() {
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY);
int heightSpec = MeasureSpec.makeMeasureSpec(getPopUpHeight(), MeasureSpec.AT_MOST);
listView.measure(widthSpec, heightSpec);
popupWindow.setWidth(listView.getMeasuredWidth());
popupWindow.setHeight(listView.getMeasuredHeight() - dropDownListPaddingBottom);
}
代码示例来源:origin: stackoverflow.com
ListView lv_marca;
lv_marca.setAdapter(adapter_marca);
int list_height = getListViewHeight(lv_marca);
private int getListViewHeight(ListView list) {
ListAdapter adapter = list.getAdapter();
int listviewHeight = 0;
list.measure(MeasureSpec.makeMeasureSpec(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
listviewHeight = list.getMeasuredHeight() * adapter.getCount() + (adapter.getCount() * list.getDividerHeight());
return listviewHeight;
}
代码示例来源:origin: stackoverflow.com
int getListViewHeight(ListView list) {
ListAdapter adapter = list.getAdapter();
list.measure(View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
int listviewHeight = list.getMeasuredHeight() * adapter.getCount() + (adapter.getCount() * list.getDividerHeight());
return listviewHeight;
}
代码示例来源:origin: stackoverflow.com
public static void expandListViewHeight(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null)
return;
ViewGroup.LayoutParams params = listView.getLayoutParams();
listView.measure(0, 0);
params.height = listView.getMeasuredHeight() * listAdapter.getCount() + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
代码示例来源:origin: com.albedinsky.android.support/support-dialogs
/**
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (mCalendarView == null || mYearsListView == null) {
return;
}
final int calendarViewWidth = mCalendarView.getMeasuredWidth();
final int calendarViewHeight = mCalendarView.getMeasuredHeight();
final MarginLayoutParams layoutParams = (MarginLayoutParams) mYearsListView.getLayoutParams();
layoutParams.width = calendarViewWidth;
layoutParams.height = calendarViewHeight;
mYearsListView.measure(
MeasureSpec.makeMeasureSpec(calendarViewWidth, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(calendarViewHeight, MeasureSpec.EXACTLY)
);
}
代码示例来源:origin: com.albedinsky.android/dialogs
/**
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if (mCalendarView == null || mYearsListView == null) {
return;
}
final int calendarViewWidth = mCalendarView.getMeasuredWidth();
final int calendarViewHeight = mCalendarView.getMeasuredHeight();
final MarginLayoutParams layoutParams = (MarginLayoutParams) mYearsListView.getLayoutParams();
layoutParams.width = calendarViewWidth;
layoutParams.height = calendarViewHeight;
mYearsListView.measure(
MeasureSpec.makeMeasureSpec(calendarViewWidth, MeasureSpec.EXACTLY),
MeasureSpec.makeMeasureSpec(calendarViewHeight, MeasureSpec.EXACTLY)
);
}
内容来源于网络,如有侵权,请联系作者删除!