开发者

Android -- Simple path, use of arcTo causes "UnsupportedOperationException?"

I'm trying to create a simple path in the onDraw method of a SurfaceView object I've created and the layout editor keeps giving me "UnsupportedOperationException: null" whenever I add an arcTo command to the path.

How do I fi开发者_StackOverflow社区x this?

Thanks,

Ryan

public class myView extends SurfaceView
{
    private Path myPath;

    public myView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onDraw(Canvas canvas)
    {
        super.onDraw(canvas);

        //set bounds
        final int top = 0 +this.getPaddingTop();
        final int bottom = this.getMeasuredHeight() - this.getPaddingBottom();
        final int left = 0 + this.getPaddingLeft();
        final int right = this.getMeasuredWidth() - this.getPaddingRight();
                int someHeight;
                int someWidth;
                innerLeft = new RectF(left + someWidth, bottom - otherHeight,
                       left + someHeight + 10 * 2, bottom);

        myPath.moveTo(left, bottom);
        myPath.lineTo(left, top + 10);
        myPath.arcTo(innerLeft, 180, 90);
        myPath.close();
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜