Forum Xamarin.Android

Newbe Question ListView within a ListView

Is it possible to have a listview within a listview or tw listviews on one page and to dynamically add columns to the bottom listview? I have an application where my top listview contains pickable items that effect the bottom listview. Dependant on the top selections the bottom listview would need to dynamically create rows and columns that a users would adjust values at the intersection of these rows and columbs?

Thanks for your help

Posts

  • CheesebaronCheesebaron DKInsider, University mod

    ListView within a ListView I don't think so. But two different ListViews in the same Layout, yes, certainly.

    Just define a Layout that looks something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <ListView
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:id="@+id/listView1" />
        <ListView
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:id="@+id/listView2" />
    </LinearLayout>
    

    You will probably need a custom Adapter for dynamically adding new entries to the bottom ListView and call NotifyDataSetChanged() when you have added or removed entries from it.

Sign In or Register to comment.