Questions tagged [android-paint]

68 questions
0
votes
1 answer

Android Paint. How is the character width calculated?

I need to know how the width of text changes when I increase paint.getTextSize() n times. I thought that is proportional, but first test indicates that it is not. I got result like below, where 1st number - size of text set by…
Jan Rozenbajgier
  • 534
  • 4
  • 13
0
votes
2 answers

java.lang.NoSuchMethodError: No virtual method getTextBounds Error in android

When I try to use the getTextBounds() method of Paint class in Android, I am getting errors on older version emulators (Marshmallow and Nougat 7.1.1). This is the error: java.lang.NoSuchMethodError: No virtual method…
ColonD
  • 954
  • 10
  • 28
0
votes
1 answer

Android screen collaboration between devices

I wanna develop a pictionary style app. I've figured out the drawing part (using canvas, paint and related libraries) on the device, and now I need to update the drawings in real time on all devices that are connected. The approach I have in mind is…
SonOfEl
  • 175
  • 1
  • 10
0
votes
0 answers

canvas drawText and emoji alpha color

the design recommendation for android regarding text legibility (https://material.io/design/color/text-legibility.html#legibility-standards) says to use for the font a black color with Alpha 87% or 60% depending on the importance of the text. So I…
zeus
  • 12,173
  • 9
  • 63
  • 184
0
votes
0 answers

How to apply radialGradient on stroke of arc in a canvas

I'm drawing arc with canvas.drawArc(...) and use below code to add gradient to paint object but the gradient just applied on the body of arc and not the stroke. how to draw a gradient stroke? paint = new Paint(); …
Soroosh
  • 543
  • 1
  • 4
  • 21
0
votes
1 answer

Drawing hollow text/deboss effect by using Canvas

I am trying to achieve this look in my android app. It is called deboss effect where the text looks hollow. I have to do this using Canvas so TextView isn't an option. My first thought was to somehow add an inner show in the text. But I couldn't…
varunkr
  • 5,364
  • 11
  • 50
  • 99
0
votes
1 answer

Paint attributes do not work when applied twice

I am trying to create a custom impact font with white color and black outline (aka the "meme font"). I have 2 texts on both ends of the canvas but only one of them reflect the changes. This is so far what I have: This is my code: Canvas…
0
votes
2 answers

How to get a reference to the top and the bottom of a canvas for dynamic positioning?

I have 2 TextViews on top of an ImageView. I am using the Canvas and Paint classes to draw the captions on the picture. I want the captions to have about 20dp of gap between the top of the image and the top of the TextView. What are some ways to…
0
votes
0 answers

Drawing a text using static layout, draws the text outside of the specific rectangle in android using canvas

I want to draw a text in a rectangle of specific size, but the result i m getting is not satisfactory. Here is the code i have tried till now: @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); mCanvas = canvas; …
0
votes
2 answers

Drop shadow blur effect on a FrameLayout / Layout in Android

I'm trying to make a drop shadow blur effect WITH COLOR on a rectangular layout view. I've tried to use this code but to no avail. int glowRadius = 14; int glowColor = Color.parseColor("#acc5fe"); Paint paint = new Paint(); …
0
votes
0 answers

How to Crop a image via finger touch in Android App?

[ORIGINAL] I am working on a project in which i need to create summary of book (combination of images). Summary includes parts of image masked by finger. I found an example for android i.e fingercrop-image-tutorial but it is not what i want. What i…
0
votes
1 answer

How to erase image with undo and redo functionality in android?

I am able to erase image by converting it in to bitmap and setting it in canvas using following code. But i am not able to set undo and redo functionality. Following code change the source bitmap so how i save path and perform undo and redo…
0
votes
0 answers

Paint: How to put spaces between vertical lines onDraw

I found this code here on SO, but I'm new to drawing things, this Visualizer Class draws ok, but I want to put spaces between the vertical lines, like how the waveform on Soundcloud looks. public class VisualizerView extends View { private static…
Relm
  • 7,923
  • 18
  • 66
  • 113
0
votes
3 answers

How to load a Custom Java View class to a RelativeLayout programmatically

I want load some Custom Views within my RelativeLayout but don't know how. The code I've tried doesn't work hence does anyone know how to do this correctly? XML
wbk727
  • 8,017
  • 12
  • 61
  • 125
0
votes
1 answer

Change color of one LinearLayout to two colors by using canvas

I'm trying to change background color of one LinearLayout to two colors for some reasons like the following pic: I'm writing this code but the problem this LinearLayout take third different color for the two parts like this pic: What is the…
Samah Ahmed
  • 419
  • 8
  • 24