package com.example.Demo1;
import com.example.Demo1.R;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
public class MainActivity extends Activity {
private LinearLayout layout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
layout = (LinearLayout) findViewById(R.id.rootLayout);
MyView myView1 = new MyView(this, 100, 100, 60);
// 设置颜色
myView1.setColor(Color.BLACK);
// 将自定义控件添加到布局中
layout.addView(myView1);
}
public class MyView extends View {
private float m_cx;
private float m_cy;
private float m_radius;
private Paint paint;
/**
*
代码简单画圆
最新推荐文章于 2024-02-03 06:02:55 发布