0

我正在尝试调用该Log.i方法来测试视图的刷新率:

public class GameView extends View {

public GameView(Context context) {
    super(context);
    }

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    canvas.drawColor(Color.WHITE);
    Log.i("OnDraw","ping");
    invalidate();
    }

为什么这不起作用?

public class GameUI extends Activity implements OnClickListener, OnTouchListener {
/** Called when the activity is first created. */

GameView gameview;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    gameview = new GameView(this);
    setContentView(gameview);
}
4

1 回答 1

1

试试这个

public GameView(Context context)
{
    super(context);
    this.setWillNotDraw(false);
}

这可能会帮助你............

于 2012-09-20T19:35:15.210 回答