欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

如何用android畫出三角形

吉茹定2年前23瀏覽0評論

如何用android畫出三角形?

原來是android.graphics.Path這個(gè)類,實(shí)現(xiàn)的。Api里的描述如下:

The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves, and cubic curves. It can be drawn with canvas.drawPath(path, Paint), either filled or stroked (based on the paint's Style), or it can be used for clipping or to draw text on a path.

它大概的意思是說path類包含了多種組件,比如直線段,二次曲線,三次曲線,它可以在畫布上繪制,無論是填充或筆畫。下面舉例說明:

[java] view plain copy

package cn.lgl.draw;

import android.content.Context;

import android.graphics.Canvas;

import android.graphics.Color;

import android.graphics.LinearGradient;

import android.graphics.Paint;

import android.graphics.Path;

import android.graphics.RectF;

import android.graphics.Shader;

import android.view.View;

public class MyView extends View {

public MyView(Context context) {

super(context);

// TODO Auto-generated constructor stub

}

@Override

protected void onDraw(Canvas canvas)

java中protected,如何用android畫出三角形