Position of the text changes when I resume my android app -



Position of the text changes when I resume my android app -

i creating android app needs draw text in canvas. drawing text in custom view. text drawn in ondraw() of custom view using drawtext() of canvas class.

the issue text position perfect. whenever press home button , 1 time again resumes app position of drawn text changes.the issue seems coming kitkat.

protected void ondraw(canvas canvas) { super.ondraw(canvas); utility utility = new utility(); canvas.drawcircle((radiusofcircle + margin), (radiusofcircle + margin), radiusofcircle, paint); endpath.moveto((2*radiusofcircle + margin), (radiusofcircle + margin)); linepaint.setcolor(color.gray); endpath.lineto(stopx, (radiusofcircle + margin)); canvas.drawpath(endpath, linepaint); linepaint.setcolor(color.parsecolor(color)); progresspath.moveto((2*radiusofcircle + margin), (radiusofcircle + margin)); progresspath.lineto(stopofprogress, (radiusofcircle + margin)); canvas.drawpath(progresspath, linepaint); canvas.drawcircle((radiusofcircle + margin), (radiusofcircle + margin), radiusofcircle, paint); paint.setstrokewidth(textstrokewidth); int xpos = radiusofcircle; int ypos = (int) ((radiusofcircle+ margin) - (utility.heightratio((progresstextcolor.descent() + progresstextcolor.ascent()) / 2, context))) ; progresstextcolor.setcolor(color.white); progresstextcolor.settextsize(utility.heightratio(10, context)); canvas.drawtext(circletext, xpos-utility.heightratio(3, context), ypos-utility.heightratio(1, context), progresstextcolor); }

android android-canvas android-custom-view android-4.4-kitkat

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -