Q: Listview inside a scrollview in xamarin I am a windows developer. I don't have much knowledge in android. So my scenario is like this: I have a scrollview which has its child as a linearlayout. The Linear layout has 3 listviews. I want to show all the items in all of the 3 listviews. The scrolling will be handled by the top level scrollview.
Will this work ?
<ScrollView
    android:scrollbars="vertical"
    android:scrollbarStyle="insideOverlay"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/scrollView1"
    android:fadeScrollbars="true">
    <LinearLayout
        android:orientation="vertical"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/linearLayout2">
        <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:id="@+id/linear_currentSubEmpty"
            android:layout_height="match_parent">

            <LinearLayout
                android:orientation="vertical"
                android:background="@android:color/transparent"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/currentListViewLayout"
                android:layout_below="@+id/currentSubsView">
                <com.fortysevendeg.swipelistview.SwipeListView xmlns:swipe="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/currentSubList"
                    android:listSelector="#00000000"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    swipe:swipeFrontView="@+id/front"
                    android:background="@android:color/transparent"
                    swipe:swipeBackView="@+id/back"
                    swipe:swipeDrawableChecked="@drawable/choice_selected"
                    swipe:swipeDrawableUnchecked="@drawable/choice_unselected"
                    swipe:swipeCloseAllItemsWhenMoveList="true"
                    swipe:swipeMode="left"
                    swipe:swipeActionLeft="reveal"
                    swipe:swipeOpenOnLongPress="false"
                    android:layout_weight="1" />
            </LinearLayout>
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:id="@+id/pastViewLayout"
            android:layout_height="match_parent">

            <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:id="@+id/linear_pastSubEmpty"
                android:layout_height="wrap_content"
                android:layout_below="@+id/pastBottomView">
                <ListView
                    android:minWidth="25px"
                    android:minHeight="25px"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:id="@+id/pastSubList"
                    android:divider="#ffffffff"
                    android:dividerHeight="1dp"
                    android:layout_weight="1" />
            </RelativeLayout>
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="match_parent"
            android:id="@+id/suspViewLayout"
            android:layout_height="match_parent">

            <RelativeLayout xmlns:tools="http://schemas.android.com/tools"
                android:layout_width="match_parent"
                android:id="@+id/linear_suspendedSubEmpty"
                android:layout_height="wrap_content"
                android:layout_below="@+id/suspBottomView">
                <ListView
                    android:minWidth="25px"
                    android:minHeight="25px"
                    android:id="@+id/suspSubList"
                    android:divider="#ffffffff"
                    android:dividerHeight="1dp"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </RelativeLayout>
        </RelativeLayout>
    </LinearLayout>
</ScrollView>


A: I got to know that there is no direct way to achieve this, I followed the following method.
public static void SetListViewHeightBasedOnChildren(ListView listView) {
        IListAdapter listAdapter = listView.Adapter;
        if (listAdapter == null) {
            return;
        }

        int totalHeight = listView.PaddingTop + listView.PaddingBottom;
        for (int i = 0; i < listAdapter.Count; i++) {
            View listItem = listAdapter.GetView(i, null, listView);
            if (listItem is ViewGroup) {
                listItem.LayoutParameters = new global::Android.Views.ViewGroup.LayoutParams (global::Android.Views.ViewGroup.LayoutParams.WrapContent, global::Android.Views.ViewGroup.LayoutParams.WrapContent);
            }
            listItem.Measure(0, 0);
            totalHeight += listItem.MeasuredHeight;
        }

        global::Android.Views.ViewGroup.LayoutParams parameters = listView.LayoutParameters;
        parameters.Height = totalHeight + (listView.DividerHeight * (listAdapter.Count - 1));
        listView.LayoutParameters = parameters;
    }

