I have a ListView. I notice that if I set the LayoutParams like the below, the ListView fetches each cell a lot of times, which makes things slow. [Code is C# as this is via Mono:]
var layoutParams = new RelativeLayout.LayoutParams (someWidth, someHeight);
layoutParams.LeftMargin = someLeftMargin;
layoutParams.TopMargin = someTopMargin;
this.LayoutParameters = layoutParams;
I can get rid of the slowness by doing the following:
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent);
this.LayoutParameters = layoutParams;
But that forces me to put an additional layer into the hierarchy unless I really do want to match the parent's size. I'd like to avoid that, if possible.
I'm wondering if it is possible for me to have the best of both worlds? Is it possible to set LayoutParams that put the ListView in an arbitrary location within its parent, without having the thing fetch each cell a whole bunch of times, thereby killing performance.