Android examples for android.widget:ListView
get Item Height of ListView
import android.view.View; import android.widget.ListAdapter; import android.widget.ListView; public class Main{ public static int getItemHeightofListView(ListView listView, int items) { ListAdapter listAdapter = listView.getAdapter(); int listviewElementsHeight = 0; for (int i = 0; i < items; i++) { View childView = listAdapter.getView(i, null, listView); childView.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); listviewElementsHeight += childView.getMeasuredHeight() + 3; }// w w w .j av a 2 s . co m return listviewElementsHeight; } }