5. Now you need to completely replace the existing onDraw method. You start by figuring outsome size-based values, including the center of the View, the radius of the circular control, and the rectangles that will enclose the outer (heading) and inner (tilt and 6. Calculate the width of the outer (heading) ring based on the size of the font used to draw the heading values:7. Calculate the height and width of the View, and use those values to establish the radius of theinner and outer face dials, as well as to create the bounding boxes for each face:8. With the dimensions of the View established, it’s time to start drawing the faces.Start from the bottom layer at the outside, and work your way in and up, starting with the outer face (heading). Create a new RadialGradient Shader using the colors and positionsyou defined in step 3.2, and assign that Shader to a new Paint before using it to draw a circle:9. Now you need to draw the artificial horizon. You do this by dividing the circular face into two sections, one representing the sky and the other the ground. The proportion of each sec¬tion depends on the current pitch.Start by creating the Shader and Paint objects that will be used to draw the sky and earth:
đang được dịch, vui lòng đợi..
