KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to draw circle with scale lines on canvas. the circle contain 100 ticks.But between 1 to 2 there is a more number of sub ticks compare to other, also I want to calculate the scale depending upon the user input(circle rotation). please help me.. i tried this http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/ private void drawScale(Canvas canvas) { //canvas.drawOval(scaleRect, scalePaint); canvas.drawCircle(0.5f,0.5f, 0.49f,scalePaint); canvas.save(Canvas.MATRIX_SAVE_FLAG); for (i = 0; i < totalNicks; ++i) { float y1 = scaleRect.top; float y2 = y1 - 0.020f; //canvas.drawLine(0.5f, y1, 0.5f, y2, scalePaint); if (i % 1 == 0) { int value = nickToDegree(i); if(value<=360) { float y3 = 0; scaleText =new Paint(); scaleText.setTextSize(0.035f); scaleText.setColor(Color.BLACK); scaleText.setTypeface(Typeface.DEFAULT_BOLD); scaleText.setTextScaleX(0.8f); scaleText.setTextAlign(Paint.Align.CENTER); scaleText.setStrokeWidth(0.015f); scaleText.setAntiAlias(true); scaleline =new Paint(); scaleline.setStyle(Paint.Style.FILL); scaleline.setColor(Color.BLACK); scaleline.setStrokeWidth(0.005f); scaleline.setAntiAlias(true); switch (value) { case 0:y3 = y1 - 0.120f; canvas.drawLine(0.5f, y1, 0.5f, y3, sc
Tags (comma-separated)
Save Edits
Cancel