这是源代码
package chenjiang.android.Test_6;import android.app.Activity;
import android.os.Bundle;public class Test_6Activity extends Activity {
    /** Called when the activity is first created. */
private GameView gameView=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        gameView=new GameView(this);
        setContentView(gameView);
    }
}
package chenjiang.android.Test_6;import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;public class GameView extends View implements Runnable { private Paint paint1=null;
public GameView(Context context) {
super(context);
paint1=new Paint();
//开启线程
new Thread(this).start();
} @Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.BLACK);
super.onDraw(canvas);
Rect rect=new Rect(50,10,50, 100);
canvas.clipRect(rect);
paint1.setAntiAlias(true);
paint1.setColor(Color.WHITE);
paint1.setStyle(Paint.Style.FILL);//设置为实心
canvas.save();
canvas.drawRect(rect, paint1);
canvas.restore();
}
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().isInterrupted();
}
//使用postInvalidate()可以直接更新界面
postInvalidate();
}

}
}
为什么显示不了图形啊,黑压压的一片,如果我把画布设置为白色,也就白了