add speed title
Closed this issue · 2 comments
djdance commented
I added some digits in a center
onDraw():
//VALUE
final String name=""+mValue;
fontPaint.setTextSize(mFontSize);
fontPaint.setFakeBoldText(true);
Rect bounds = new Rect();
fontPaint.getTextBounds(name, 0, name.length(), bounds);
canvas.drawText(name, getWidth()/2, getHeight()/2, fontPaint);
//mph
fontPaint.setTextSize(mFontSize/2);
fontPaint.setFakeBoldText(false);
canvas.drawText("mph", getWidth()/2, getHeight()/2+bounds.height(), fontPaint);
init():
fontPaint = new Paint();
fontPaint.setColor(Color.BLACK);
fontPaint.setTextAlign(Paint.Align.CENTER);
fontPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
CustomGauge():
mFontSize = a.getInt(R.styleable.CustomGauge_fontSize, 40);
attrs.xml:
<attr name="fontSize" format="integer" />
pkleczko commented
hi, nice to have. can you fork and add it to project?
djdance commented
sorry, Im a nub and just download the zip. I can upload the zip :)
But I was forced to change attrs.xml names from "gaugeCamelName" to "camelName"