I have a ListView and I want to create a background that scrolls with a list.
I saw Shelves code that works because all the elements in the GridView are the same height, which is a guarantee that I cannot do it. I suppose I can use a similar method (that is, override dispatchDraw), but I need to know the distance from the top of the ListView for each item - how can I pre-compute it? The ListView is mostly static and quite small, so itβs good if I have to recount when adding a new item to the list.
So my question is this: given that ListView and List adapter, how can I calculate the distance of each item at the top of the list? That is, element 0 will be 0 pixels from above, element 20 may be 4032 pixels from above. Alternatively, is there a better way to do what I want to do?
source share