drawtext

Android Center text on canvas

偶尔善良 提交于 2019-11-27 05:49:27
I'm trying to display a text using the code below. The problem is that the text is not centered horizontally. When I set the coordinates for drawText , it sets the bottom of the text at this position. I would like the text to be drawn so that the text is centered also horizontally. This is a picture to display my problem further: @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); //canvas.drawRGB(2, 2, 200); Paint textPaint = new Paint(); textPaint.setARGB(200, 254, 0, 0); textPaint.setTextAlign(Align.CENTER); textPaint.setTypeface(font);

Android Canvas.drawText

好久不见. 提交于 2019-11-27 03:22:29
I have a view, I'm drawing with the Canvas object in the onDraw(Canvas canvas) method. My code is: Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStyle(Style.FILL); canvas.drawPaint(paint); paint.setColor(android.R.color.black); paint.setTextSize(20); canvas.drawText("Some Text", 10, 25, paint); The problem is the text doesn't show through the background, what am I doing wrong? If I remove the canvas.drawPaint(paint) and paint.setColor(android.R.color.black) you can see the text on the screen..... Worked this out, turns out that android.R.color.black is not the same as Color

ffmpeg moving text drawtext

六眼飞鱼酱① 提交于 2019-11-26 23:42:42
问题 I'm using ffmpeg library to draw text on video in specific time and i'm success to do that Now i need to move the text from position to another and i can't do that so can any one suggest me how to do that i'm using this command to move text from top to down but i can't determine the x and Y to move from the x,y to specific x,y ffmpeg -i VideoInput.mp4 -vf "drawtext=enable='between(t,12,14)':fontfile=myfont.otf:text='Test test':x=(w-text_w)/2:y=w/50\*mod(t\,2):fontsize=65" -acodec copy

Android 4.2 on Nexus 7: canvas.drawText() not working correctly

最后都变了- 提交于 2019-11-26 17:48:16
问题 I'm facing a serious issue with my Application, published on Google Play and apparently working fine on all versions of Android except for > 4.0. This is a screenshoot from my Android 4.0 HTC phone: And this is what I get on Nexus 7, Android 4.2.1 (same behaviour in the emulator): I see the same behaviour for each text drawn using canvas.drawText() the Paint used to draw text is: paint = new Paint(); paint.setAntiAlias(true); paint.setColor(color); //some color paint.setTextSize(size); //some

Android Center text on canvas

风格不统一 提交于 2019-11-26 11:45:50
问题 I\'m trying to display a text using the code below. The problem is that the text is not centered horizontally. When I set the coordinates for drawText , it sets the bottom of the text at this position. I would like the text to be drawn so that the text is centered also horizontally. This is a picture to display my problem further: @Override protected void onDraw(Canvas canvas) { // TODO Auto-generated method stub super.onDraw(canvas); //canvas.drawRGB(2, 2, 200); Paint textPaint = new Paint()

Android Canvas.drawText

£可爱£侵袭症+ 提交于 2019-11-26 10:29:55
问题 I have a view, I\'m drawing with the Canvas object in the onDraw(Canvas canvas) method. My code is: Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStyle(Style.FILL); canvas.drawPaint(paint); paint.setColor(android.R.color.black); paint.setTextSize(20); canvas.drawText(\"Some Text\", 10, 25, paint); The problem is the text doesn\'t show through the background, what am I doing wrong? If I remove the canvas.drawPaint(paint) and paint.setColor(android.R.color.black) you can see