Separator (divider) after last item of ListView

前端 未结 6 1981
再見小時候
再見小時候 2021-01-31 01:46

When I create a simple layout with only a ListView in it, there is no separator displayed after the last item, which looks a bit ugly.



        
6条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 02:22

    I've come with a hack that works around this problem. Since the last separator is displayed only if another view follows the list view, it is possible to make that second view invisible by setting its layout_height to 0dp.

    It's still a hack, but it makes to last divider look consistent with the other, so it's better that trying to manually create a horizontal line with trying to guess the right colour and dimensions.

    
    
    
        
    
            
    
    

提交回复
热议问题