How to get gravity 'bottom' working on a drawable in xml

前端 未结 7 1468
南方客
南方客 2021-02-12 15:41

I have a simple aim. I want a light grey background on my FrameLayout with a black dividing line underneath it (only undernearth, not all around). So far I have this:

<         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-12 16:40

    I've struggled a lot with this as well. Basically, to create a border at the bottom, you have to think in opposite direction from what you expect. You start with a rectangle with your Border color. On top of that, you draw the actual color, with an offset from the bottom. I use this:

    
    
    
        
        
            
                
            
        
    
        
        
            
                
            
        
    
    

    Or, as Juan Pablo Saraceno suggested :

     
         
             
         
         
             
         
    
    

提交回复
热议问题