Separator (divider) after last item of ListView

前端 未结 6 1973
再見小時候
再見小時候 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:44

    It seems somewhat different when your listview is displayed if you code it like that. But even you can follow this too.

    First define a style named Line

    
    

    // In the above style you can change the height of the line as per your requirement.

    Wherever you want to use the above line, you can declare it like this in your xml file.

    
     
    
    
    
    
    
    

    The above code creates a line under your listview. The above code is most useful when you wanna use it in various places in your project. Or if want at only one place, you can do it like this.

     
         
    
    
    
    

    Hope this helps. BTW The reason is vague and even once I did search for this and I followed this way which I explained above.

提交回复
热议问题