2014-11-11 16 views

Antwort

20

unter einem einfachen Beispiel finden abgerundete Ecke Polygonen (d.h.es Dreieck, Rechteck etc.)

@Override 
    public void draw(Canvas canvas) {    
     Paint paint = new Paint(); 
     paint.setColor(Color.GREEN); 
     paint.setStrokeWidth(6); 
     float radius = 50.0f; 
     CornerPathEffect corEffect = new CornerPathEffect(radius); 
     paint.setPathEffect(corEffect); 
     Path path = new Path(); 
     path.moveTo(20, 20); 
     path.lineTo(400, 20); 
     path.lineTo(600, 300); 
     path.lineTo(400, 400); 
     path.lineTo(20, 400); 
     path.close(); 
     canvas.drawPath(path, paint); 
    } 

zu ziehen, um die Höhe der Rundung zu steuern, den Wert des Radius ändern. Hoffe, das wird dir helfen, dein Problem zu lösen. Vielen Dank.