WPS2016打印如何节省纸张(wpsoffice怎么打印一张纸)
2023-09-27
更新时间:2022-04-17 12:37:03作者:佚名
Color
//方法1
int color1 = Color.BLUE;
//方法2
int color2 = Color.argb(177, 255,255,255);
//方法3:在xm l里面定义颜色
该类的对象用于控制画笔的风格和颜色等方面的信息
paint.setColor(Color.BLUE);
复制代码Canvas
该类代表在一块“画布”,可以在画布上绘制字符,图形,图片等内容;
canvas.drawCircle(300, 400, 100, paint);
自定义View的基本实现方法
1.定义一个类,继承View;
2.复写View的onDraw函数;
3.在onDraw当中使用Canvas和Paint对象绘制图形;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_main);
setContentView(new MyView(this));
}
}
import android.R.color;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class MyView extends View {
public MyView(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
//当Android系统需要绘制一个View对象时,就会调用该对象的onDraw
@Override
protected void onDraw(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.BLUE);
canvas.drawLine(0, 0, 200, 200, paint);
super.onDraw(canvas);
}
}