1.线line:



    


2.椭圆oval:



    
    


3.长方形rectangle:



    
    
    


4.填充颜色solid、渐变gradient、边角corners:



    
    
    
        
        
                              
            
            




5.代码编写

//白色背景shape
int strokeWidth = 5; // 3dp
int roundRadius = 15; // 8dp
int strokeColor = Color.parseColor("#2E3135");
int fillColor = Color.parseColor("#DFDFE0");
GradientDrawable gd = new GradientDrawable();
gd.setColor(fillColor);
gd.setCornerRadius(roundRadius);
gd.setStroke(strokeWidth, strokeColor);