-3

`public class Sample extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(new Draw (これ));

} 

private class Draw extends View {
    public Draw (Context context) {
        super(context);
    }

    @Override 
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);


        Paint paint1 = new Paint();
        paint1.setColor(Color.BLUE);
        paint1.setAntiAlias(true);


        Paint paint2 = new Paint();
        paint2.setColor(Color.BLACK);
        paint2.setAntiAlias(true);


        Paint paint3 = new Paint();
        paint3.setColor(Color.YELLOW);
        paint3.setAntiAlias(true);


        Paint paint4 = new Paint();
        paint4.setColor(Color.WHITE);
        paint4.setAntiAlias(true);

        Paint paint5 = new Paint();
        paint5.setColor(Color.RED);
        paint5.setAntiAlias(true);


        canvas.drawColor(Color.BLACK);

        canvas.drawCircle(200, 200, 180, paint1);


        canvas.drawLine(220, 180, 280, 40, paint2);
        canvas.drawLine(220, 180, 280, 40, paint2);

        canvas.drawLine(260, 170, 370, 100, paint2);
        canvas.drawLine(260, 170, 370, 100, paint2);

        canvas.drawLine(380, 200, 260, 200, paint2);
        canvas.drawLine(380, 200, 260, 200, paint2);

        canvas.drawLine(350, 300, 260, 240, paint2);
        canvas.drawLine(350, 300, 260, 240, paint2);

        canvas.drawLine(280, 370, 230, 260, paint2);
        canvas.drawLine(280, 370, 230, 260, paint2);

        canvas.drawLine(200, 380, 200, 200, paint2);
        canvas.drawLine(200, 380, 200, 200, paint2);

        canvas.drawLine(100, 350, 200, 200, paint2);
        canvas.drawLine(100, 350, 200, 200, paint2);

        canvas.drawLine(40, 300, 200, 200, paint2);
        canvas.drawLine(40, 300, 200, 200, paint2);

        canvas.drawLine(120, 200, 20, 200, paint2);
        canvas.drawLine(120, 200, 20, 200, paint2);

        canvas.drawLine(40, 100, 200, 200, paint2);
        canvas.drawLine(40, 100, 200, 200, paint2);

        canvas.drawLine(120, 40, 200, 200, paint2);
        canvas.drawLine(120, 40, 200, 200, paint2);

        canvas.drawLine(200, 200, 200, 20, paint2);
        canvas.drawLine(200, 200, 200, 20, paint2); 


    }
}

}`

円を表示したいのですが、これをAndroid SDKにロードすると大きすぎます。ビットマップコードが必要だと思いますが、どこに配置すればよいかわかりません...誰か助けてください。

4

1 に答える 1

0

あなたが達成しようとしていることは 100% わかりませんが、円が大きく見える場合は、円を変更できますradius

これが役立つことを願っています。

于 2012-08-15T14:53:50.253 に答える