How do I avoid double borders between lists?

后端 未结 3 984
一个人的身影
一个人的身影 2021-01-15 16:20

I am using a list view in which I have an xml referencing drawable/list as follows:



        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-15 16:43

    The reason for having two lines is, that the background (second layer) lets shine thru the white part on both ends, at the bottom and the top. Therefore every list entry gets a white line on top and on bottom. As list items have a small distance between each other you see two lines.

    Two things you need to do

    • For each item, let only one (top or bottom) shine thru. Therefore you get only one line per item. The drawable XML for an item:

      
      
      
          
          
      
      
      
          
              
              
          
      
      
      
    • For the whole list, you need the drawable that shows the one missing line. The drawable XML for this looks nearly the same. Just bottom and top is exchanged:

      
      
      
          
          
      
      
      
          
              
              
          
      
      
      

提交回复
热议问题