package com.naozary.android.example.simple;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
public class simple extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.main);
setContentView(new GraphicsTestView(this));
}
}
class GraphicsTestView extends View {
public GraphicsTestView(Context context) {
super(context);
}
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(
Color.argb(
255, // 透明度
255, // Red
255, // Green
0 // Blue
)
);
canvas.drawCircle(
120.5f, // The x-coordinate of the center of the cirle to be drawn
100.5f, // The y-coordinate of the center of the cirle to be drawn
40.0f, // The radius of the cirle to be drawn
paint
);
paint.setAntiAlias(true);
canvas.drawCircle(
120.5f, // The x-coordinate of the center of the cirle to be drawn
200.5f, // The y-coordinate of the center of the cirle to be drawn
40.0f, // The radius of the cirle to be drawn
paint
);
}
}
【実行結果】
0 件のコメント:
コメントを投稿