Shape drawable as background, a line at the bottom

前端 未结 7 1289
旧时难觅i
旧时难觅i 2020-12-07 11:58

I am using a drawable as a background of a TextView just to have a divider line below the text. A achivied it with this drawable-xml:



        
7条回答
  •  执念已碎
    2020-12-07 12:37

    Usually for similar tasks - I created layer-list drawable like this one:

    
    
        
            
        
    
    
        
            
        
    
    

    The idea is that first you draw the rectangle with underlineColor and then on top of this one you draw another rectangle with the actual buttonColor but applying bottomPadding. It always works.

    But when I needed to have buttonColor to be transparent I couldn't use the above drawable. I found one more solution

    
    
        
            
        
    
    
    
    
    

    (as you can see here the mainButtonColor is transparent and white_box is just a simple rectangle drawable with white Solid)

提交回复
热议问题