The code below is a custom view β it draws a circle, adds marks in accordance with the scale, and adds scale text. This was obtained from Mind The Robot as an excellent tutorial on creating an old thermometer. http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/
This code works fine on devices running before Jelly Bean 4.1.2, but it breaks down into 4.2. At 4.2, the numbers no longer stretch around the circle, but seem to spread across the screen. The code worked fine on Nexus 7 until it got update 4.2, so it can't be a device issue. I tested it on Nexus S running 4.1.2, and Nexus 4 works 4.2, it works fine on Nexus S, but not Nexus 4.
Unfortunately, as a new user, I canβt post screenshots, Iβll try to describe it: the numbers are displayed correctly for the first half of the dial, the remaining numbers are scattered across the screen.
I looked at the changelog 4.2, but I do not see anything that could lead to this. I looked for similar problems online, but it all looks like hardware acceleration - I tried various combinations of setting hardware acceleration in the manifest, but nothing affected.
I would really appreciate any contribution to what might be causing this.
import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; public class AneroidView extends View {
source share