Open Prashanthlkv opened 9 years ago
I'm having the same problem. Some help?
Hello,
Your solution still not work on Android 5.x .Nothing is displayed.
Sylvain
Thanks for your reply.
I copied your workaround method and use it in the drawScale method of GaugeView class. Call is like that in the project :
canvas.drawText(valueString(mScaleStartValue + value), 0.5f, y3 + 0.045f, paint);
I changed to use with your workaround method like that :
drawText(canvas, valueString(mScaleStartValue + value), 0.5f, y3 + 0.045f, 1f, paint);
Note that the size parameter is never used in your workaround method. For me, on Android 5.0.1 no text is displayed.
Did you make any other changes ?
I guess I haven't the good version of you drawText workaround method because size parameter is never used in the version you posted on github comment.
So, it has no effect to change value.
In the git issue section code is like that :
private void drawText(Canvas canvas, String value, float x, float y,
float size, Paint paint) {
// Save original font size
float originalTextSize = paint.getTextSize();
// set a magnification factor
final float magnifier = 100f;
// Scale the canvas
canvas.save();
canvas.scale(1f / magnifier, 1f / magnifier);
// increase the font size
paint.setTextSize(originalTextSize * magnifier);
canvas.drawText(value, x * magnifier, y * magnifier, paint);
// canvas.drawTextOnPath(value, textPath, 0.0f, 0.0f, paint);
// bring everything back to normal
canvas.restore();
paint.setTextSize(originalTextSize);
}
but size variable is never used in your code. So, change value won't have any impact.
I have no skype but we can exchange thanks to gmail if you want : sylvain.saurel@gmail.com
If you solve the problem please say your conclusions here. Tks
After viewed your screenshots, i think it's changes from your side that solves the problem.
Try to apply your method with code on the github repo and you will see the problem
Here's a complete tutorial for this gauge view which is updated and works for android:
Hi Sulejman, thanks for the code, kindly tell me how can i set the needle to the value say 30 or 40 or some other value. here the needle is rotating every second based on the timer method in the activity file. i want to pass values like 10 or 20 or 30 and so on and want the needle to point to that location. Kindly help me on this.
Please post that question here in the comment section:
I am running the your code in LG Nexus(Loolipop) and all the scales is showing as zero(0) instead of 0,10,20,30,40,50,60,70,80,90,100. Please help me in resolving this.Thanks in advance