How to make the corners of a button round?

前端 未结 13 800
暖寄归人
暖寄归人 2020-11-22 16:36

I want to make the corners of a button round. Is there an easy way to achieve this in Android?

13条回答
  •  花落未央
    2020-11-22 17:37

    If you want something like this

    Button preview

    here is the code.

    1.Create a xml file in your drawable folder like mybutton.xml and paste the following markup:

    
    
        
            
                
                
                            
            
        
        
            
                
                
                       
            
          
        
           
                
                
                            
           
        
    
    

    2.Now use this drawable for the background of your view. If the view is button then something like this:

提交回复
热议问题