Android - Canvas drawLine inside ImageView

前端 未结 1 1452
野的像风
野的像风 2021-01-04 13:25

I\'ve one ImageView in which I want to draw a Line. I\'ve done the follow:

mImagenCampo = (ImageView) findViewById(R.id.imagen_campo); 

相关标签:
1条回答
  • 2021-01-04 13:59

    Try this:

    private void crearPunto(float x, float y, float xend, float yend, int color) {
    
        bmp = Bitmap.createBitmap(mImagenCampo.getWidth(), mImagenCampo.getHeight(), Config.ARGB_8888);
        c = new Canvas(bmp);
            mImagenCampo.draw(c);
    
        Paint p = new Paint();
        p.setColor(color);
        c.drawLine(x, y, xend, yend, p);
        mImagenCampo.setImageBitmap(bmp);
    }
    
    0 讨论(0)
提交回复
热议问题