How to draw rounded rectangle in Android UI?

前端 未结 8 987
北海茫月
北海茫月 2020-11-27 11:46

I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView and EditText would also be helpful.

8条回答
  •  失恋的感觉
    2020-11-27 12:20

    I think, this is you exactly needed.

    Here drawable(xml) file that creates rounded rectangle. round_rect_shape.xml

    
    
        
    
        
    
    
    

    Here layout file: my_layout.xml

    
    
        
    
        
    
            
        
    
    

    -> In the above code, LinearLayout having the background(That is the key role to place to create rounded rectangle). So you can place any view like TextView, EditText... in that LinearLayout to see background as round rectangle for all.

提交回复
热议问题