plectrum

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 5eefc34a0b3e41974123fcd705cfd6265fb18265
parent 50e75b7c177e135cc8f8782195629bd02c57c099
Author: gstraube <gstraube@mailbox.org>
Date:   Mon, 10 Jul 2017 06:22:05 +0200

Center text

Diffstat:
Mapp/src/main/java/com/github/cythara/TunerView.java | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/src/main/java/com/github/cythara/TunerView.java b/app/src/main/java/com/github/cythara/TunerView.java @@ -37,7 +37,10 @@ public class TunerView extends View { if (pitchDifference != null) { setBackground(canvas); - canvas.drawText(pitchDifference.closest.name(), x, y, paint); + String note = pitchDifference.closest.name(); + float offset = paint.measureText(note) / 2F; + + canvas.drawText(note, x - offset, y, paint); } }