Android fully shaped Button

前端 未结 1 794
长发绾君心
长发绾君心 2021-01-20 23:45

I tried to change the shape of some Android components like Button or View. What I can do is assign a shape to the background with the onDraw-Method. Well, it looks like reshape

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-21 00:25

    You can define the shapes in xml (as you can see here). e.g. :

    drawable/sample_shape.xml:

    
        
        
        
    
    

    Then you can use the xml description as a drawable for an ImageButton.

    drawable/samplebutton.xml:

    
    
         
         
         
    
    

    in your layoutfile:

    
    
    

    0 讨论(0)
提交回复
热议问题