2011-09-17 9 views
-2

大文字のような形のパスに沿ってテキストを書きたいZ文字。定義済みのパスにテキストを書き込む

私は次のコードを書いています。テキストを長方形に沿って描画します。
Zという形のパスを作成し、テキストに従わせるために必要なことは何ですか?

protected void onCreate(Bundle savedInstanceState) 
     { 
     super.onCreate(savedInstanceState); 
     Display display = getWindowManager().getDefaultDisplay(); 
     setContentView(new SampleView(this,display.getWidth(),display.getHeight())); 
     } 

     private static class SampleView extends View 
     { 
     int width; 
     int height; 
     public SampleView(Context context,int w,int h) 
     { 
      super(context); 
      width=w; 
      height=h; 
     } 

     @Override 
     protected void onDraw(Canvas canvas) 
     { 
      Path mypath = new Path(); 

      mypath.addRect(width/2,height/2,width,height,Path.Direction.CCW); 

      // set the color and font size 
      Paint paint = new Paint(); 
      paint.setColor(Color.RED); 
      paint.setTextSize(30); 
      paint.setAntiAlias(true); 

      // draw the text along the circle 
      canvas.drawTextOnPath("Hi This Is Sample String",mypath, 0, 30, paint); 
     } 
     } 
    } 
+0

私はいくつかの文字列を書きたい – Mat

+0

など、より具体的に、そしてあなたがこれまでに試したかを示す、あなたが立ち往生しているところ下さい'Z'のようなパターンが書かれています –

+0

あなたは以前に試したもの/検索したものを表示する必要があります。あなた自身が実際にこれをやろうと努力したことを示してください。 – Mat

答えて

関連する問題