How to make Floating Action Button background Gradient?

后端 未结 7 2080
长情又很酷
长情又很酷 2020-12-30 12:00

The code for FAB:



        
7条回答
  •  情书的邮戳
    2020-12-30 12:17

    The accepted answer is working fine but after adding the below line, it stretches the icon added on FAB

    56dp
    

    I am sharing the screenshots:

    Previous FAB button

    After adding design_fab_image_size in dimen.xml and adding android:src="@drawable/gradient", the icon get stretched:

    To deal with this I replaced my gradient.xml with the following code:

    
    
        
            
            
        
    
    
        
            
        
    
    
        
            
                
            
        
    
    

    Output:

提交回复
热议问题