我试图在画布上使用drawRect绘制一些东西,它让我发疯 .

我使用以下代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginTop="0px"
    android:layout_marginBottom="0px"
    android:layout_marginLeft="0px"
    android:layout_marginRight="0px"
    >
<ru.maaaah.client.android.GameView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />
</LinearLayout>

我的GameView代码是:

protected void onDraw(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.WHITE);
    paint.setAntiAlias(false);
    paint.setStrokeWidth(1);
    paint.setStyle(Paint.Style.STROKE);
    canvas.drawRect(new Rect(0, 0, 100, 100), paint);
}

问题是矩形缺少左侧!

如果我使用Rect(1,1,100,100)进行绘制,则看起来好像左上角的Canvas角不是(0,0) .

我正在使用运行Android 4.3的Galaxy III .

请帮助,我完全失去了 .