Add margins to Snackbar view

前端 未结 17 1453
时光取名叫无心
时光取名叫无心 2020-12-06 16:20

I\'m updating my current app to use snackbars, in the Google spec they show various ways of using them http://www.google.com/design/spec/components/snackbars-toasts.html#sna

17条回答
  •  情深已故
    2020-12-06 17:00

    Adding CoordinatorLayout or Frame Layout and then setting margin didn't work for me

    To tackle this problem use Drawable Background where use item to set Margin and shape to set desired Padding

    container_snackbar.xml

    
    
        
        
    
            
            
                
    
                
                
                
    
            
        
    
    

    And then from Activity set that Drawable

    MainActivity.java

    Snackbar snack = Snackbar
                     .make(activity,"Hello World 

提交回复
热议问题