List of usage examples for android.widget Adapter getView
View getView(int position, View convertView, ViewGroup parent);
From source file:com.optimusinfo.elasticpath.cortex.common.Utils.java
@SuppressWarnings("rawtypes") public static int getTotalHeightofListView(AdapterView argAdapterView) { Adapter mAdapter = argAdapterView.getAdapter(); if (mAdapter == null) { // pre-condition return 0; }/*from ww w . j ava2s. c o m*/ int totalHeight = 0; for (int i = 0; i < mAdapter.getCount(); i++) { View mView = mAdapter.getView(i, null, argAdapterView); mView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); mView.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); totalHeight += mView.getMeasuredHeight(); } return totalHeight; }