只显示了我的第二张图片,后面的刷新没有用,大神帮忙看看什么问题
//重写OnDraw()
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
paint=new Paint();
switch (state) {
case GAME_LOADING:
Log.i("aaaaaaaaaaaaaaaa", " "+bgtag); //有打印
canvas.drawBitmap(bmpBg[bgtag], 0, 0, paint);
break;
case GAME_MENU:
break;
case GAME_RUN:
canvas.drawBitmap(pp1, 80.0f+ppx1, 50+ppx2, paint);
canvas.drawBitmap(pp2, 600, 70, paint);
canvas.drawBitmap(pp3, 300, 200, paint);
canvas.drawBitmap(pp4, 500, 250, paint);
break;
default:
break;
}
}
//线程
public void run() {
// TODO Auto-generated method stub
while(isrun){
switch (state) {
case GAME_LOADING:
Log.i("sssssssss", " "+bgtag);
bgtag++;
if(bgtag>3){
bgtag=0;
}
break;
default:
break;
}
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
onDraw(canvas);
}
}
------解决方案--------------------
state是什么状态,怎么变换的
onDraw(canvas);的canvas怎么来的
采用的是view还是surfaceview
========
信息提供不够
------解决方案--------------------
代码不全啊,思路理不清啊。