martinsimov02
Member
Hello, I'm trying to fit n items inside the xCustomListView. Right now when i add the items, that last visible item is sometimes cut in half or barely showing. As i have multiple custom lists inside my app and the last visible item on every single custom list is not fully shown the appearance of the app is not as expected.
I created a method that takes the height of the custom list, the divider size and how many items should be fitted in the custom list when the scroll position is at it's initial state.
This method returns the height of the items that will go inside this custom list.
This method kinda works, but the bigger the VisibleRows property is the more inaccurate the result is.
For example if VisibleRows is 10 a few pixels of the eleventh item will be visible.
If Someone can provide me with a better method to calculate the row height it will be great.
I also wonder how to calculate the VisibleRows property so it can fit more items when the screen height is bigger.
I created a method that takes the height of the custom list, the divider size and how many items should be fitted in the custom list when the scroll position is at it's initial state.
This method returns the height of the items that will go inside this custom list.
Calculate Row Height Method:
Public Sub CalculateRowHeight(ListViewHeight As Int, DividerHeight As Int, VisibleRows As Float) As Int
Dim RowHeight As Int = ListViewHeight / VisibleRows
'Since the xCustomListView adds a divider to the top of the list but doesnt add divider to the bottom of the list, the bottom divider will have to be split between the height of all the items.
Dim LastRowDivider As Int = DividerHeight / VisibleRows
Return RowHeight - DividerHeight - LastRowDivider
End Sub
This method kinda works, but the bigger the VisibleRows property is the more inaccurate the result is.
For example if VisibleRows is 10 a few pixels of the eleventh item will be visible.
If Someone can provide me with a better method to calculate the row height it will be great.
I also wonder how to calculate the VisibleRows property so it can fit more items when the screen height is bigger.