how can I draw a text in the lower right of the screen?
heres my code on drawtext.
EDIT
Rect textBounds = new Rect();
if(this != null) {
timeCounter.start();
int time= timeCounter.getTimeSeconds();
String timetxt= String.format("%02d:%02d", time/60, time%60);
timer.getTextBounds(timetxt, 0, text.length(), textBounds);
canvas.drawText(timetxt, -textBounds.left, -textBounds.top, timer);
}
I just follow some tutorials but it doesn't work. can someone help me on this logic? thanks in advance !
i hope you are trying to do this within a views ondraw callback.
if so, 2 things you might want to consider.
sind upper left corner is 0,0 any value for textbounds.left or textbounds.right > 0 would at least partially hide your text.
if you want this to be drawn at the lower right corner you need to call this:
canvas.drawText(timetxt, this.getWidth()-textBounds.left, this.getHeight()-textBounds.top, timer);
if you are not doing this in a onDrawCallback, move it into one ;)