How to get listview height in android?
问题 I need to find the height of android ListView with custom ListVAdapter. Each of ListView items can be of varying height. I have tried the following code which I found here: public static void setListViewHeightBasedOnChildren(ListView listView) { ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { return; } int totalHeight = 0; for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView); listItem.measure(0, MeasureSpec