Change the color of divider in LinearLayout

后端 未结 3 1026
攒了一身酷
攒了一身酷 2021-02-20 09:41

May I know how I can change the color of divider in LinearLayout?



        
3条回答
  •  说谎
    说谎 (楼主)
    2021-02-20 09:52

    It looks like android:divider attribute doesn't accept a color value. So you have to create a separate divider drawable in order to get it works:

    divider.xml

    
    
    
        
        
    
    
    

    layout.xml

    
    

    Also, please note that android:divider is only available in android 3.0 or higher and it doesn't work in previous android versions.

提交回复
热议问题