Chap6. 인터페이스 기초03 - Custom View, Toast, Beep, Vibration, etc
패키지명 :chap6_prac
package ddwucom.mobile.chap6_prac;
import androidx.appcompat.app.AppCompatActivity;
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 MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MyView vw = new MyView(this); //내부(아래)에 선언한 MyView 객체 생성
setContentView(vw);
}
class MyView extends View {
public MyView(Context context) {
super(context);
}
public void onDraw(Canvas canvas) {
canvas.drawColor(Color.LTGRAY);
Paint pnt = new Paint();
pnt.setColor(Color.BLUE);
canvas.drawCircle(100,100,80,pnt);
}
}
}