---
title: "fit the size of view exactly to path i darw in it"  
description: "fit the size of view exactly to path i darw in it"  
author: "Pravesh Singh"  
published: 2013-05-29  
updated: 2013-05-30  
canonical: https://www.mindstick.com/forum/939/fit-the-size-of-view-exactly-to-path-i-darw-in-it  
category: "android"  
tags: ["android"]  
reading_time: 1 minute  

---

# fit the size of view exactly to path i darw in it

Hi All,\
this is onDraw [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) in my [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) [view](https://yourviews.mindstick.com/view/84701/layoffs-in-google-india-2023-view)i draw the [speech](https://www.mindstick.com/news/1973/with-surprising-accuracy-an-ai-could-decode-speech-from-brain-activity) bubble with [path](https://www.mindstick.com/articles/44333/4-expert-tips-on-how-to-pick-the-right-career-path)and i want the [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files) of view exactly be the same as speech bubble i darw\
protected void onDraw([Canvas](https://www.mindstick.com/forum/1383/how-can-i-print-a-canvas-in-wpf) canvas) { super.onDraw(canvas); [Paint](https://www.mindstick.com/forum/161444/fid-is-being-replaced-by-inp-what-is-inp-interaction-to-next-paint) paint = new Paint(); paint.setColor(Color.BLACK); paint.setAntiAlias([true](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true)); paint.setStrokeWidth(2); paint.setStrokeJoin(Paint.Join.ROUND); paint.setStrokeCap(Paint.Cap.ROUND); paint.setPathEffect(new CornerPathEffect(15) ); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setShader(new LinearGradient(0, 0, 0, getHeight(), Color.BLACK, Color.WHITE, Shader.TileMode.MIRROR)); Path path = new Path(); paint.setShadowLayer(4, 2, 2, 0x80000000); path.moveTo(myPath[0].x, myPath[0].y); for ([int](https://www.mindstick.com/forum/159137/how-to-convert-date-int-to-date-in-sql) i = 1; i < myPath.length; i++){ path.lineTo(myPath[i].x, myPath[i].y); } path.close(); canvas.drawPath(path, paint); }\
how can do this?Thanks for advance.

## Replies

### Reply by AVADHESH PATEL

Hi Pravesh!\
Try as following\
canvas.clipPath(path) canvas.drawPath(path, paint);\
canvas.save();\
I hope this code might be resolve your problem.


---

Original Source: https://www.mindstick.com/forum/939/fit-the-size-of-view-exactly-to-path-i-darw-in-it

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
