• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PathShape类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.graphics.drawable.shapes.PathShape的典型用法代码示例。如果您正苦于以下问题:Java PathShape类的具体用法?Java PathShape怎么用?Java PathShape使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PathShape类属于android.graphics.drawable.shapes包,在下文中一共展示了PathShape类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: ColorChip

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public ColorChip(int color, boolean messageRead, Path shape) {
    if (shape.equals(STAR)) {
        mDrawable = new ShapeDrawable(new PathShape(shape, 280f, 280f));
    } else {
        mDrawable = new ShapeDrawable(new PathShape(shape, 320f, 320f));
    }

    if (messageRead) {
        // Read messages get an outlined circle
        mDrawable.getPaint().setStyle(Paint.Style.STROKE);
    } else {
        // Unread messages get filled, while retaining the outline, so that they stay the same size
        mDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE);
    }

    mDrawable.getPaint().setStrokeWidth(20);
    mDrawable.getPaint().setColor(color);
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:19,代码来源:ColorChip.java


示例2: ColorChip

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public ColorChip(int color, boolean messageRead, Path shape) {

        if (shape.equals(STAR)) {
            mDrawable = new ShapeDrawable(new PathShape(shape, 280f, 280f));

        } else {
            mDrawable = new ShapeDrawable(new PathShape(shape, 320f, 320f));
        }
        if (shape.equals(CHECKMARK)) {
            mDrawable.getPaint().setStrokeWidth(50);
        } else {
            mDrawable.getPaint().setStrokeWidth(20);
        }
        if (messageRead) {
            // Read messages get an outlined circle
            mDrawable.getPaint().setStyle(Paint.Style.STROKE);
        } else {
            // Unread messages get filled, while retaining the outline, so that they stay the same size
            mDrawable.getPaint().setStyle(Paint.Style.FILL_AND_STROKE);

        }
        mDrawable.getPaint().setColor(color);


    }
 
开发者ID:daxslab,项目名称:daxSmail,代码行数:26,代码来源:ColorChip.java


示例3: initSquare

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
private void initSquare(Context context) {
    if (mTriangle == null) {
        TypedValue typedValue = new TypedValue();
        Theme theme = context.getTheme();

        // triangle
        Path chipPath = new Path();
        chipPath.moveTo(500f, 0f);
        chipPath.lineTo(500f, 500f);
        chipPath.lineTo(0f, 500f);
        chipPath.close();
        mTriangle = new ShapeDrawable(new PathShape(chipPath, 500f, 500f));
        mTriangle.setDither(true);
        int triangleColor = Color.parseColor("#cc1f1f1f");
        if (theme.resolveAttribute(R.attr.cp_badgeTriangleColor, typedValue, true)) {
            triangleColor = typedValue.data;
        }
        mTriangle.getPaint().setColor(triangleColor);

        // line
        mLinePaint = new Paint();
        int lineColor = Color.parseColor("#ffffffff");
        if (theme.resolveAttribute(R.attr.cp_badgeLineColor, typedValue, true)) {
            lineColor = typedValue.data;
        }
        mLinePaint.setColor(lineColor);
        mOffset = 1.5f * mDensity;
        mLinePaint.setStrokeWidth(mOffset);
    }

    initOverlay(context, new RectShape());
}
 
开发者ID:hwding,项目名称:templated-messaging,代码行数:33,代码来源:ContactBadge.java


示例4: drawDocumentBox

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
private void drawDocumentBox(Point[] points, Size stdSize) {

        Path path = new Path();

        HUDCanvasView hud = mMainActivity.getHUD();

        // ATTENTION: axis are swapped

        float previewWidth = (float) stdSize.height;
        float previewHeight = (float) stdSize.width;

        path.moveTo( previewWidth - (float) points[0].y, (float) points[0].x );
        path.lineTo( previewWidth - (float) points[1].y, (float) points[1].x );
        path.lineTo( previewWidth - (float) points[2].y, (float) points[2].x );
        path.lineTo( previewWidth - (float) points[3].y, (float) points[3].x );
        path.close();

        PathShape newBox = new PathShape(path , previewWidth , previewHeight);

        Paint paint = new Paint();
        paint.setColor(Color.argb(64, 0, 255, 0));

        Paint border = new Paint();
        border.setColor(Color.rgb(0, 255, 0));
        border.setStrokeWidth(5);

        hud.clear();
        hud.addShape(newBox, paint, border);
        mMainActivity.invalidateHUD();
    }
 
开发者ID:Aniruddha-Tapas,项目名称:Document-Scanner,代码行数:31,代码来源:ImageProcessor.java


示例5: drawGooView

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
/** 通过绘制Path构建一个ShapeDrawable,用来绘制到画布Canvas上 **/
private ShapeDrawable drawGooView() {
	Path path = new Path();
	// 1. 根据当前两圆圆心的距离计算出固定圆的半径
	float distance = GeometryUtil.getDistanceBetween2Points(mDragPoint, mStickPoint);
	tempRadius = getCurrentRadius(distance);
	// 2. 计算出经过两圆圆心连线的垂线的dragLineK(对边比临边)。求出四个交点坐标
	float xDiff = mStickPoint.x - mDragPoint.x;
	Double dragLineK = null;
	if (xDiff != 0) {
		dragLineK = (double) ((mStickPoint.y - mDragPoint.y) / xDiff);
	}
	// 分别获得经过两圆圆心连线的垂线与圆的交点(两条垂线平行,所以dragLineK相等)。
	PointF[] dragPoints = GeometryUtil.getIntersectionPoints(mDragPoint, dragRadius,
			dragLineK);
	PointF[] stickPoints = GeometryUtil.getIntersectionPoints(mStickPoint,
			tempRadius, dragLineK);
	// 3. 以两圆连线的0.618处作为 贝塞尔曲线 的控制点。(选一个中间点附近的控制点)
	PointF newPoint = GeometryUtil.getPointByPercent(mDragPoint, mStickPoint, 0.618f);
	// 绘制两圆连接
	path.moveTo(stickPoints[0].x, stickPoints[0].y);
	path.quadTo(newPoint.x, newPoint.y, dragPoints[0].x, dragPoints[0].y);
	path.lineTo(dragPoints[1].x, dragPoints[1].y);
	path.quadTo(newPoint.x, newPoint.y, stickPoints[1].x, stickPoints[1].y);
	path.close();
	// 将四个交点画到屏幕上
	// drawAssistPoint(path, dragPoints, stickPoints);
	// 构建ShapeDrawable
	ShapeDrawable shapeDrawable = new ShapeDrawable(new PathShape(path, 50f, 50f));
	shapeDrawable.getPaint().setColor(Color.RED);
	return shapeDrawable;
}
 
开发者ID:zhaodecang,项目名称:BageView,代码行数:33,代码来源:GooView.java


示例6: createSignatureBitmap

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
/**
 * 1. Iterating over the path points, saving them in an array ... not bueno. Try to use
 * {@link android.graphics.PathMeasure} class and get minX and minY from that.
 * <p>
 * 2. Scale bitmap down. Currently drawing at density of device.
 */
public Bitmap createSignatureBitmap() {

    Paint bitmapSigPaint = new Paint(sigPaint);
    bitmapSigPaint.setColor(sigPrintColor);

    RectF sigBounds = new RectF();
    sigPath.computeBounds(sigBounds, true);

    if (sigBounds.width() != 0 && sigBounds.height() != 0) {
        float density = getResources().getDisplayMetrics().density;
        int dipWidth = (int) (sigBounds.width() / density);
        int dipHeight = (int) (sigBounds.height() / density);

        Bitmap returnedBitmap = Bitmap.createBitmap(dipWidth, dipHeight,
                Bitmap.Config.ARGB_4444);

        float minX = Integer.MAX_VALUE;
        float minY = Integer.MAX_VALUE;

        for (LinePathPoint point : sigPoints) {
            minX = Math.min(minX, point.x);
            minY = Math.min(minY, point.y);
        }

        sigPath.offset(-minX, -minY);

        PathShape pathShape = new PathShape(sigPath, sigBounds.width(), sigBounds.height());
        pathShape.resize(dipWidth, dipHeight);

        Canvas canvas = new Canvas(returnedBitmap);
        pathShape.draw(canvas, bitmapSigPaint);

        return returnedBitmap;
    }

    return null;
}
 
开发者ID:ResearchStack,项目名称:ResearchStack,代码行数:44,代码来源:SignatureView.java


示例7: crossLineButtonClick

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public void crossLineButtonClick(View view){
    Path path = new Path();
    path.moveTo(0, 12);
    path.lineTo(100, 88);

    ShapeBackgroundSpan shapeSpan = new ShapeBackgroundSpan(0xFF000000, new PathShape(path, 100, 100), true);
    shapeSpan.setStrokeWidth(6);

    textView.setSelectionSpan(shapeSpan, new ArrowBackgroundSpan(0xFF7373, 0x22000000));
}
 
开发者ID:7heaven,项目名称:md2tv,代码行数:11,代码来源:MainActivity.java


示例8: crossLineButtonClick

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public void crossLineButtonClick(View view){
    Path path = new Path();
    path.moveTo(0, 12);
    path.lineTo(100, 88);

    ShapeBackgroundSpan shapeSpan = new ShapeBackgroundSpan(0xFF000000, new PathShape(path, 100, 100), true);
    shapeSpan.setStrokeWidth(6);

    editText.setSelectionSpan(shapeSpan, new ArrowBackgroundSpan(0xFF7373, 0x22000000));
}
 
开发者ID:7heaven,项目名称:CurtainSlidingMenu,代码行数:11,代码来源:MainActivity.java


示例9: init

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
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);
}
 
开发者ID:rogerallen,项目名称:GridStrument,代码行数:31,代码来源:GridView.java


示例10: onSizeChanged

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
@Override
protected void onSizeChanged(int w, int h, int oldW, int oldH) {
    mPath.build(mCalloutMarker, w, h, mStroke.getPaint().getStrokeWidth(), mCornerRadius);
    PathShape shape = new PathShape(mPath, w, h);
    mFill.setShape(shape);
    mStroke.setShape(shape);
}
 
开发者ID:shamanland,项目名称:facebook-like-button,代码行数:8,代码来源:FacebookLikeBox.java


示例11: OutlineDrawableView

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public OutlineDrawableView(Context context, int radius) {
    super(context);

    this.radius = radius;
    width_dp = radius * 6;

    // Convert to dp
    stroke = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, stroke,
            getResources().getDisplayMetrics());

    outline1 = new ShapeDrawable(new RectShape());
    Paint paint1 = outline1.getPaint();
    paint1.setColor(0x55000000);
    paint1.setStrokeWidth(stroke);
    paint1.setAntiAlias(true);
    paint1.setStyle(Paint.Style.STROKE);

    outline2 = new ShapeDrawable(new RectShape());
    Paint paint2 = outline2.getPaint();
    paint2.setColor(0x55ffffff);
    paint2.setStrokeWidth(stroke);
    paint2.setAntiAlias(true);
    paint2.setStyle(Paint.Style.STROKE);

    Path path = new Path();
    path.moveTo(0, 0);
    path.lineTo(width_dp, width_dp);
    path.moveTo(0, width_dp);
    path.lineTo(width_dp, 0);
    crosshair = new ShapeDrawable(new PathShape(path, width_dp, width_dp));
    Paint paint3 = crosshair.getPaint();
    paint3.setColor(0xbb000000);
    paint3.setStrokeWidth(Math.max(stroke/2, 1));
    paint3.setAntiAlias(true);
    paint3.setStyle(Paint.Style.STROKE);
}
 
开发者ID:dektar,项目名称:ColorNamer,代码行数:37,代码来源:OutlineDrawableView.java


示例12: draw

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
/**
 * Draw the graphic on the supplied canvas.  Drawing should use the following methods to
 * convert to view coordinates for the graphics that are drawn:
 * <ol>
 * <li>{@link GraphicOverlay.Graphic#scaleX(float)} and {@link GraphicOverlay.Graphic#scaleY(float)} adjust the size of
 * the supplied value from the preview scale to the view scale.</li>
 * <li>{@link GraphicOverlay.Graphic#translateX(float)} and {@link GraphicOverlay.Graphic#translateY(float)} adjust the
 * coordinate from the preview's coordinate system to the view coordinate system.</li>
 * </ol>
 *
 * @param canvas drawing canvas
 */
@Override
public void draw(Canvas canvas) {
    //TODO fix the coordinates see http://zhengrui.github.io/android-coordinates.html

    if(scannedDoc != null && scannedDoc.detectedQuad != null){
        //boolean isPortrait = Util.isPortraitMode(mOverlay.getContext());
        Path path = new Path();

        /*
        Log.d("DOC-GRAPHIC", "IsPortrait? " + isPortrait);

        float tlX = isPortrait? translateY((float) scannedDoc.detectedQuad.points[0].y):translateX((float) scannedDoc.detectedQuad.points[0].x);
        float tlY = isPortrait? translateX((float) scannedDoc.detectedQuad.points[0].x):translateY((float) scannedDoc.detectedQuad.points[0].y);

        Log.d("DOC-GRAPHIC", "Top left: x: " + scannedDoc.detectedQuad.points[0].x + ", y: " + scannedDoc.detectedQuad.points[0].y
                + " -> x: " + tlX + ", y: " + tlY);

        float blX = isPortrait? translateY((float) scannedDoc.detectedQuad.points[1].y):translateX((float) scannedDoc.detectedQuad.points[1].x);
        float blY = isPortrait? translateX((float) scannedDoc.detectedQuad.points[1].x):translateY((float) scannedDoc.detectedQuad.points[1].y);

        Log.d("DOC-GRAPHIC", "Bottom left: x: " + scannedDoc.detectedQuad.points[1].x + ", y: " + scannedDoc.detectedQuad.points[1].y
                + " -> x: " + blX + ", y: " + blY);

        float brX = isPortrait? translateY((float) scannedDoc.detectedQuad.points[2].y):translateX((float) scannedDoc.detectedQuad.points[2].x);
        float brY = isPortrait? translateX((float) scannedDoc.detectedQuad.points[2].x):translateY((float) scannedDoc.detectedQuad.points[2].y);

        Log.d("DOC-GRAPHIC", "Bottom right: x: " + scannedDoc.detectedQuad.points[2].x + ", y: " + scannedDoc.detectedQuad.points[2].y
                + " -> x: " + brX + ", y: " + brY);

        float trX = isPortrait? translateY((float) scannedDoc.detectedQuad.points[3].y):translateX((float) scannedDoc.detectedQuad.points[3].x);
        float trY = isPortrait? translateX((float) scannedDoc.detectedQuad.points[3].x):translateY((float) scannedDoc.detectedQuad.points[3].y);

        Log.d("DOC-GRAPHIC", "Top right: x: " + scannedDoc.detectedQuad.points[3].x + ", y: " + scannedDoc.detectedQuad.points[3].y
                + " -> x: " + trX + ", y: " + trY);
        */
        int frameWidth = scannedDoc.getImage().getMetadata().getHeight();

        path.moveTo(((float)(frameWidth - scannedDoc.detectedQuad.points[0].y)), ((float)scannedDoc.detectedQuad.points[0].x));
        path.lineTo(((float)(frameWidth - scannedDoc.detectedQuad.points[1].y)), ((float)scannedDoc.detectedQuad.points[1].x));
        path.lineTo(((float)(frameWidth - scannedDoc.detectedQuad.points[2].y)), ((float)scannedDoc.detectedQuad.points[2].x));
        path.lineTo(((float)(frameWidth - scannedDoc.detectedQuad.points[3].y)), ((float)scannedDoc.detectedQuad.points[3].x));
        path.close();

        PathShape shape = new PathShape(path, scannedDoc.getImage().getMetadata().getHeight(), scannedDoc.getImage().getMetadata().getWidth());
        shape.resize(canvas.getWidth(), canvas.getHeight());

        shape.draw(canvas, bodyPaint);
        shape.draw(canvas, borderPaint);

        //canvas.drawPath(path, borderPaint);
        //canvas.drawPath(path, bodyPaint);

        Log.d("DOC-GRAPHIC", "DONE DRAWING");
    }
}
 
开发者ID:Credntia,项目名称:CVScanner,代码行数:68,代码来源:DocumentGraphic.java


示例13: hfb

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
public hfb(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
  super(paramContext, paramAttributeSet, paramInt);
  setWillNotDraw(false);
  Context localContext = getContext();
  Resources localResources = localContext.getResources();
  this.B = localResources.getDimensionPixelSize(aau.yx);
  this.A = localResources.getDrawable(aau.yD);
  this.w = localResources.getDimensionPixelSize(aau.yv);
  this.g = localResources.getDimensionPixelSize(aau.yw);
  this.b = localResources.getDimensionPixelSize(aau.yB);
  this.l = localResources.getDimensionPixelSize(aau.yC);
  int i1 = this.l;
  int i2 = this.b;
  int i3 = localResources.getColor(aau.yn);
  Point localPoint1 = new Point(0, 0);
  Point localPoint2 = new Point(0, i2);
  Point localPoint3 = new Point(i1, i2 / 2);
  Path localPath = new Path();
  localPath.setFillType(Path.FillType.EVEN_ODD);
  localPath.lineTo(localPoint2.x, localPoint2.y);
  localPath.lineTo(localPoint3.x, localPoint3.y);
  localPath.lineTo(localPoint1.x, localPoint1.y);
  localPath.close();
  ShapeDrawable localShapeDrawable = new ShapeDrawable(new PathShape(localPath, i1, i2));
  localShapeDrawable.getPaint().setColor(i3);
  this.a = localShapeDrawable;
  this.u = localResources.getDimensionPixelSize(aau.ys);
  this.v = localResources.getDimensionPixelOffset(aau.yr);
  this.x = localResources.getDimensionPixelSize(aau.yp);
  this.C = localResources.getDimensionPixelSize(aau.yu);
  this.c = new Button(localContext, null, 0);
  TypedArray localTypedArray = localContext.obtainStyledAttributes(new int[] { 16843534 });
  this.c.setBackgroundResource(localTypedArray.getResourceId(0, 0));
  localTypedArray.recycle();
  this.c.setGravity(16);
  this.c.setMaxLines(1);
  this.c.setEllipsize(TextUtils.TruncateAt.END);
  this.c.setVisibility(8);
  addView(this.c);
  this.e = new TextView(localContext);
  this.e.setEllipsize(TextUtils.TruncateAt.END);
  addView(this.e);
  this.d = new TextView(localContext);
  this.d.setMaxLines(1);
  this.d.setEllipsize(TextUtils.TruncateAt.END);
  addView(this.d);
  this.f = new TextView(localContext);
  this.f.setMaxLines(1);
  this.f.setEllipsize(TextUtils.TruncateAt.END);
  this.f.setTextAppearance(localContext, aau.yL);
  addView(this.f);
  this.i = new TextView(localContext);
  this.i.setGravity(16);
  this.i.setTextAppearance(localContext, aau.yL);
  this.i.setAllCaps(true);
  this.i.setText(localResources.getString(efj.Gq));
  this.i.setVisibility(8);
  addView(this.i);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:61,代码来源:hfb.java


示例14: drawGooView

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
/**
	 * 通过绘制Path构建一个ShapeDrawable,用来绘制到画布Canvas上
	 * @return
	 */
	private ShapeDrawable drawGooView() {
		Path path = new Path();
		
		
		//1. 根据当前两圆圆心的距离计算出固定圆的半径
		float distance = (float) GeometryUtil.getDistanceBetween2Points(mDragCenter, mStickCenter);
		stickCircleTempRadius = getCurrentRadius(distance);
		
		//2. 计算出经过两圆圆心连线的垂线的dragLineK(对边比临边)。求出四个交点坐标
		float xDiff = mStickCenter.x - mDragCenter.x;
		Double dragLineK = null;
		if(xDiff != 0){
			dragLineK = (double) ((mStickCenter.y - mDragCenter.y) / xDiff);
		}
		
			//分别获得经过两圆圆心连线的垂线与圆的交点(两条垂线平行,所以dragLineK相等)。
		PointF[] dragPoints = GeometryUtil.getIntersectionPoints(mDragCenter, dragCircleRadius, dragLineK);
		PointF[] stickPoints = GeometryUtil.getIntersectionPoints(mStickCenter, stickCircleTempRadius, dragLineK);
		
		//3. 以两圆连线的0.618处作为 贝塞尔曲线 的控制点。(选一个中间点附近的控制点)
		PointF pointByPercent = GeometryUtil.getPointByPercent(mDragCenter, mStickCenter, 0.618f);
		

		// 绘制两圆连接
		//此处参见示意图{@link https://github.com/PoplarTang/DragGooView }
		path.moveTo((float)stickPoints[0].x, (float)stickPoints[0].y);
		path.quadTo((float)pointByPercent.x, (float)pointByPercent.y,
				(float)dragPoints[0].x, (float)dragPoints[0].y);
		path.lineTo((float)dragPoints[1].x, (float)dragPoints[1].y);
		path.quadTo((float)pointByPercent.x, (float)pointByPercent.y,
				(float)stickPoints[1].x, (float)stickPoints[1].y);
		path.close();
		
		//将四个交点画到屏幕上
//		path.addCircle((float)dragPoints[0].x, (float)dragPoints[0].y, 5, Direction.CW);
//		path.addCircle((float)dragPoints[1].x, (float)dragPoints[1].y, 5, Direction.CW);
//		path.addCircle((float)stickPoints[0].x, (float)stickPoints[0].y, 5, Direction.CW);
//		path.addCircle((float)stickPoints[1].x, (float)stickPoints[1].y, 5, Direction.CW);
		
		//构建ShapeDrawable
		ShapeDrawable shapeDrawable = new ShapeDrawable(new PathShape(path, 50f, 50f));
		shapeDrawable.getPaint().setColor(Color.RED);
		return shapeDrawable;
	}
 
开发者ID:chenxiangkong,项目名称:imitateQQ,代码行数:49,代码来源:GooView.java


示例15: fillDrawableMap

import android.graphics.drawable.shapes.PathShape; //导入依赖的package包/类
private void fillDrawableMap(Context context, Map<Category.CategoryType, Drawable> result) {
    // EXPENSE
    final Path expensePath = new Path();
    expensePath.moveTo(0, 50);
    expensePath.lineTo(15, 100);
    expensePath.lineTo(400, 100);
    expensePath.lineTo(400, 0);
    expensePath.lineTo(15, 0);
    //path.lineTo(0, 50);
    expensePath.close();

    final ShapeDrawable expenseDrawable = new ShapeDrawable(new PathShape(expensePath, 400, 100));
    expenseDrawable.getPaint().setShader(new LinearGradient(0, 0, convertPixelsToDp(context.getResources().getDisplayMetrics().widthPixels, context), 0,
            Color.argb(50, 255, 0, 0), Color.argb(0, 255, 0, 0), Shader.TileMode.CLAMP)); // RED

    result.put(Category.CategoryType.EXPENSE, expenseDrawable);

    // INCOME
    final Path incomePath = new Path();
    incomePath.moveTo(0, 0);
    incomePath.lineTo(0, 100);
    incomePath.lineTo(385, 100);
    incomePath.lineTo(400, 50);
    incomePath.lineTo(385, 0);
    //path.lineTo(0, 0);
    incomePath.close();

    final ShapeDrawable incomeDrawable = new ShapeDrawable(new PathShape(incomePath, 400, 100));
    incomeDrawable.getPaint().setShader(new LinearGradient(0, 0, convertPixelsToDp(context.getResources().getDisplayMetrics().widthPixels, context), 0,
            Color.argb(0, 0, 255, 0), Color.argb(50, 0, 255, 0), Shader.TileMode.CLAMP)); // GREEN

    result.put(Category.CategoryType.INCOME, incomeDrawable);

    // TRANSFER
    final Path transferPath = new Path();
    transferPath.moveTo(0, 50);
    transferPath.lineTo(15, 100);
    transferPath.lineTo(385, 100);
    transferPath.lineTo(400, 50);
    transferPath.lineTo(385, 0);
    transferPath.lineTo(15, 0);
    //path.lineTo(0, 50);
    transferPath.close();

    final ShapeDrawable transferDrawable = new ShapeDrawable(new PathShape(transferPath, 400, 100));
    transferDrawable.getPaint().setShader(new LinearGradient(0, 0, convertPixelsToDp(context.getResources().getDisplayMetrics().widthPixels, context), 0,
            Color.argb(50, 255, 0, 0), Color.argb(50, 0, 255, 0), Shader.TileMode.CLAMP)); // RED -> GREEN

    result.put(Category.CategoryType.TRANSFER, transferDrawable);
}
 
开发者ID:Adonai,项目名称:WalletMaster,代码行数:51,代码来源:OperationView.java



注:本文中的android.graphics.drawable.shapes.PathShape类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZMQException类代码示例发布时间:2022-05-21
下一篇:
Java HttpClientConnection类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap