How to change the divider height of listview dynamically?

后端 未结 1 619
我在风中等你
我在风中等你 2021-01-06 08:49

I have a listview in which there should be different divider height between different rows. So, how can we set the divider height dynamically?

Suppose, I have 10 row

相关标签:
1条回答
  • 2021-01-06 09:16

    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.

    0 讨论(0)
提交回复
热议问题