我正在尝试调用Log.i
方法来测试View的刷新率:
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);
}
答案 0 :(得分:1)
试试这个
public GameView(Context context)
{
super(context);
this.setWillNotDraw(false);
}
这可能对你有帮助..........