I have a listview in which there should be different divider height between different rows. So, how can开发者_JAVA百科 we set the divider height dynamically?
Suppose, I have 10 rows and there should be a divider height of 5 between first 2 rows and then there should be a divider height of 1 between next 5 rows and so on.
Can someone let me know the way of doing this?
One way would be to make the dividers rows. Set them as not enabled in your isEnabled
adapter method. I do that for section headers, but it is almost the same thing. Another way would be to manually lay out your whole list by implementing onLayout. If the dividers can be empty space, it might work to set top or bottom margins for the root view of your rows. In xml that would be:
android:layout_marginTop='5px'
Otherwise, just make the dividers part of the rows.
精彩评论