Questions tagged [android-paint]
68 questions
2
votes
1 answer
Android canvas doesn't draw the text on my bitmap
I'm trying to get the text input from the user and draw it on the image using Canvas but the image is saved without what was supposed to be drawn. Right now, I'm just trying to get the text on the Image before I worry about the font, colour,…

Andros Adrianopolos
- 664
- 5
- 20
2
votes
6 answers
How to create a rectangle with two rounded corners?
I need to create a rectangle view with two rounded corners using canvas.I used drawRoundRect but i am getting rectangle with four rounded corners.Please anyone suggest me a way that can be helpful in solving my problem.
rect = new RectF(left, top,…

sai krishna Gottimukkala
- 65
- 1
- 6
2
votes
1 answer
Blend alpha of overlapped area without adding alpha
I don't know if what I'm asking is possible.
I've a Paint with Color.BLACK with 0.2f of alpha and two objects:
They both use the same Paint. I've also tested with 2 different Paint objects changing only the PorterDuffXfermode but I had no success.…

GuilhE
- 11,591
- 16
- 75
- 116
2
votes
1 answer
How to efficiently resize image with antialias?
I try to resize an image like this:
aPaint.setAntiAlias(true); // Enabling this flag will cause all draw operations that support antialiasing to use it.
aPaint.setFilterBitmap(True); // enable bilinear sampling on scaled bitmaps. If cleared, scaled…
user8614758
2
votes
2 answers
How to create graph with edges and vertices in Android
I want to create graph (with edges and vertices), to implement a problem called 3-color. I just need a little guidance on how to start, should i use a multiple views and draw each view as a circle, and then how can i connect lines (edges) between…

T.S
- 911
- 8
- 24
2
votes
0 answers
Android Path FILL_AND_STROKE not completely filling inside of Path
I am seeing a weird fill behavior on some of the Paths I am drawing to a Canvas in Android. When the Path has a stroke and a fill (Paint style Paint.Style.FILL_AND_STROKE) and the Path is sharply curved, the Paths stroke renders correctly but the…

jacobmoncur
- 46
- 2
- 2
2
votes
1 answer
How tro draw fading path
How can I draw Path with fading (opacity or thicknes) line? Something like this.
I know there is LinearGradient shader for Paint, but it won't bend along the Path.
One possible solution might be to get points along the Path and just draw it by…

Pitel
- 5,334
- 7
- 45
- 72
1
vote
2 answers
How to draw four boundary corner in canvas for qr code scanner
I need to draw in canvas four boundary corner for qr code scanner. Here is example (I need to draw this four blue boundary corner).
I know how to draw rectangle:
val rectF = RectF(left, top, right, bottom)
canvas.drawRoundRect(rectF,…

testivanivan
- 967
- 13
- 36
1
vote
1 answer
Masking inputted text using canvas on android kotlin
I'm currently doing a custom pin code and doing it with a canvas and paint, Unfortunately I cant seems to copy what the iputType="numberPassword" is doing with my custom design, I want to show the number momentarily before masking it and proceed to…

user3262438
- 73
- 1
- 8
1
vote
0 answers
How Android Zoom works properly?
Circle 1 in the image shows the correct location.But when I draw the same circle in the second circle area, there is a different background. I have trouble solving the problem.Can you help me ?
if (zooming) {
zMatrix!!.reset()
…

Sercan Işık
- 11
- 1
1
vote
0 answers
Paint is not visible when we use xfermode as PorterDuffXfermode(PorterDuff.Mode.DARKEN) in Android 10
I'm drawing a background color in canvas using a Paint object. I'm using xfermode as PorterDuffXfermode(PorterDuff.Mode.DARKEN) for this paint. The background color is visible in devices below Android 10. But when I run in Android 10 devices, the…

Vijay
- 545
- 1
- 5
- 15
1
vote
1 answer
How to center text horizontally on Canvas
I have an ImageView with 2 TextViews. I am trying to align the captions by its median with the median (width/2) of the Canvas. Here is an illustration of what I'm trying to achieve:
https://i.stack.imgur.com/R5AmI.jpg
So far, my attempt aligns the…

Andros Adrianopolos
- 664
- 5
- 20
1
vote
1 answer
One edge of stroke is bigger after change the left in Rect
I try to create a stroke for my view and it work well if the left and top is 0.
After I change the left rect, the left edge stroke is bigger than normal.
Example, I set the left to 10
public class SimpleView extends View {
Paint paint = new…

Linh
- 57,942
- 23
- 262
- 279
1
vote
1 answer
Custom Progress Bar's drawable does not fit
I am trying to implement the below progress bar:
and the result I am getting is:
The problem here is that the lines do not fit in the progress bar as it is clear in the left and right side of the image. The reason is that I am using the progress…

Davi
- 1,031
- 12
- 21
1
vote
0 answers
Filling a shape of multiple paths
I have created a shape with multiple paths on a canvas and now I want to fill that shape with a color, I tried using paint.setStyle(Paint.Style.FILL); but that only seems to fill the paths separately, my question is how to fill the whole shape.
Here…

smovie9
- 788
- 1
- 8
- 16