Code example for RoundRectShape

0
      sd.draw(canvas);
       
      float[] R = new float[] { 10, 10, 10, 10,10, 10, 10, 10 };
      RectF   inset = new RectF(10,10,10,10);
      /* µe¤@­Ó¦³©·¨¤ªº¥¿¤è§Î */  
      sd=new ShapeDrawable(new RoundRectShape(R, null,null));
      sd.getPaint().setShader(mShader);
      sd.setBounds(120,20,200,100);
      sd.draw(canvas);
      /* µe¤@­ÓªÅ¤ß¥B¦³©·¨¤ªº¥¿¤è§Î */  
      sd=new ShapeDrawable(new RoundRectShape(R,inset,R));
      sd.getPaint().setShader(mShader);
      sd.setBounds(220,20,300,100);
      sd.draw(canvas);
      /* µe¤@­ÓªÅ¤ß¶ê */ 
      sd=new ShapeDrawable(new OvalShape());
      sd.getPaint().setStrokeWidth(3);
      sd.getPaint().setStyle(Paint.Style.STROKE);
      sd.getPaint().setShader(mShader);
      sd.setBounds(20,120,100,200);
      sd.draw(canvas);