How to set listview height in android
Flutter horizontal listview dynamic height...
Method for Setting the Height of the ListView dynamically.
Listview height flutter
- Android User Interface
Description
Method for Setting the Height of the ListView dynamically.
Demo Code
import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.ListAdapter; import android.widget.ListView; publicclass Main { /****/*fromwww.java2s.com*/ * Method for Setting the Height of the ListView dynamically.*** Hack to fix * the issue of not showing all the items of the ListView *** when placed inside * a ScrollView ****/publicstaticvoid setListViewHeightBasedOnChildren(ListView listView, RecyclerView recyclerView) { ListAdapter listAdapter = listView.getAdapter(); RecyclerView.Adapter adapter = recyclerView.getAdapter(); if (listAdapter == null) return; int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.UNSPECIFIED); int totalHeight = 0; View view = null; for (int i = 0; i < listAdapter.getCount(); i++) { view = listAdapter.getView(i, view, listView); if (i == 0) view.setLayoutParams(new V