Questions tagged [android-paint]

68 questions
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
  • 9,795
  • 5
  • 45
  • 112
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
  • 195
  • 1
  • 15
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
  • 4,854
  • 8
  • 38
  • 87
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
0 answers

How to make canvas elements (drawText) focusable

I'm trying to adjust my app to work on Android TV and therefore its required to make all the elements focusable. In my app, I use the grid of texts which are actually painted on the Canvas (basically android.graphics.Canvas): canvas.drawText(letter,…
user846316
  • 5,089
  • 3
  • 23
  • 37
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
  • 6,458
  • 16
  • 56
  • 101
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
SD826E
  • 6,673
  • 7
  • 45
  • 92
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
  • 389
  • 6
  • 23
0
votes
1 answer

How do I paint over an Imageview?

I have an ImageView which I drew four lines. Now I want the user to be able to draw over the image. How can this be achieved? On the other solution I saw that we have to add another view, a custom view, this solution is not suited for this…
user6332149
0
votes
0 answers

How to fill the color in the enclosed area in android

public void connectLipLine(int start, int end, Bitmap bitmap, Canvas canvas) { Paint mPaint = new Paint(); mPaint.setColor(Color.GREEN); mPaint.setStyle(Paint.Style.STROKE); mPaint.setAntiAlias(true); mPaint.setDither(true); …