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

前端 未结 7 1469
南方客
南方客 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:45

    I know it's pretty old question but given answers didn't work for me. Turns out in order to gravity property work you just need to add size tag in drawable item.

    So following will work as expected:

    
    
        
            
                
            
        
        
            
                
                
            
        
    
    

    ps. this feature added in api level 23 https://developer.android.com/reference/android/graphics/drawable/LayerDrawable#setLayerGravity%28int,%20int%29

提交回复
热议问题