How to set listview height in android

        1. How to set listview height in android
        2. Flutter horizontal listview dynamic height...

          Method for Setting the Height of the ListView dynamically.

          Listview height flutter

        3. Listview height flutter
        4. If my items height was same i can use something like but i cant.
        5. Flutter horizontal listview dynamic height
        6. I need to set a relevant maximum height for a ListView.
        7. Looking around the internet I've seen several ways to set the height of a ListView.
        8. - 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