GridView.java 文件源码

java
阅读 30 收藏 0 点赞 0 评论 0

项目:GridStrument 作者:
private void init() {
    Log.d("init", String.format("width: %d; height: %d", this.getWidth(), this.getHeight()));
    Path gridPath = new Path();
    int N = 4;
    float dN = 200f;
    for(int i = 0; i <= N; i++) {
        gridPath.moveTo(i * dN, 0);
        gridPath.lineTo(i * dN, N*dN);
        gridPath.moveTo(0, i * dN);
        gridPath.lineTo(N*dN, i * dN);
    }
    gridPath.close();

    mGridDrawable = new ShapeDrawable(new PathShape(gridPath, this.getWidth(), this.getHeight()));
    mGridDrawable.getPaint().setColor(0xffeeeeee);//0xff74AC23);
    mGridDrawable.getPaint().setStyle(Paint.Style.STROKE);
    mGridDrawable.getPaint().setStrokeWidth(2.0f);
    mGridDrawable.setBounds(0, 0, this.getWidth(), this.getHeight());

    mIntersectPath = new Path();
    mIntersectPaint = new Paint();
    mIntersectPaint.setColor(0xff74AC23);
    mIntersectPaint.setStyle(Paint.Style.STROKE);
    mIntersectPaint.setStrokeWidth(3.0f);
    mIntersectPath1 = new Path();
    mIntersectPaint1 = new Paint();
    mIntersectPaint1.setColor(0xffAC2374);
    mIntersectPaint1.setStyle(Paint.Style.STROKE);
    mIntersectPaint1.setStrokeWidth(1.0f);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号