Style bottom Line in Android

后端 未结 14 2631
独厮守ぢ
独厮守ぢ 2020-11-28 17:53

I need to create an android shape so that only the bottom has stroke (a dashed line). When I try the following, the stroke bisects the shape right through the center. Does a

14条回答
  •  忘掉有多难
    2020-11-28 18:34

    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)

提交回复
热议问题