How to change the divider height of listview dynamically?

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 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?

Answers


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.


Need Your Help

Getting System.ServiceModel.ProtocolException while Consuming WCF Webservice

c# asp.net wcf web-services

I am consuming a WCF web service to which i have no control in web service side.