Skip to content Skip to sidebar Skip to footer

Listview Changing Size Of (reused) Views

I am all for reusing views in listview. I always set visibility, contents, witdth etc. of all controls again in getView Unfortunately it seems ListView fails to recalculate height.

Solution 1:

For what it is worth, problem appeared to be related to the imageview. Just for reference, I will write here how I solved it.

  1. In getView I fixed the imageview width to screen width (instead of "wrap-content" and/or parent view width - earlier code used OnGlobalLayoutListener for parent width)
  2. I switched over to using SetDrawable instead of SetImageBitmap. It is odd, but this difference was actual very important in solving the odd space around the imageview after scrolling an item/row in/out of view.

My research did also indicate that others had problems using wrap_content in listview for cases similar to mine, but I was not able to find anyone who had experienced exact same problems as me.

Post a Comment for "Listview Changing Size Of (reused) Views"