I have an MvxListView that I'm populating by clicking an "Add" button, which functions fine. The problem is that the list view's height needs to expand when I add an item. I've tried setting android:layout_height="wrap_content", but that doesn't seem to work. Here's the code for the button and list:
<Button
android:text="Add One"
local:MvxBind="Click AddSomething" />
<Mvx.MvxListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
local:MvxItemTemplate="@layout/listitem_template"
local:MvxBind="ItemsSource ProjectModel.Something" />
I'm not sure what you're trying to do makes that much sense...
If you want the list to grow beyond the current screen-height, then use a non-zero size initially - e.g. use android:layout_height="fill_parent"
or android:layout_height="200dp"
initially - the list will then grow and will eventually scroll as the list contents get long enough to cause overflow.
If you really want a control that changes size as items are added, then you can use MvxLinearLayout
instead - but beware that if the list gets large then:
If you really want a ListView that dynamically sizes, then you can probably do something like inheriting from MvxListView
, and you can then intercept when child views get added to work out and set the new height using SetLayoutParams- but I'm not sure that this will be that great a UX.