Wednesday, December 12, 2012

Horizontal ListView for Mono for Android!

I have previously ported a nice HorizontalPager from Java to Mono for Android, which works fine, however in order for it to work it needs to load all the views into the memory, which can produce a sluggish behavior if using some resource intensive views inside of it. This is where the Horizontal ListView is a lot better as it extends AdapterView instead of ViewGroup, which essentially means it is filled by an Adapter. Why is this good you might ask. This is both good but also very awesome because Adapters help minimizing the memory footprint as they load Views when they are actually needed, contrary to ViewGroup which does not contain such functionality per. default.

The Horizontal ListView was ported from Paul Soucy's implementation for Java and then additional functionality which adds Snap mode and also since I have been working a bit with MvvmCross lately a binding class has been added.

You can check out the project out on GitHub, where there are demo projects included for running on vanilla Mono for Android and one for running with MvvmCross!

Update!
I made a short demonstration video, see it here: