Java 仅在星系注4上发生的随机闪烁
出于某种原因,我发现了一个毫无意义的小故障,正如我现在所想,它只出现在Galaxy Note 4上。我仅有的测试设备是Nexus 7(2012)、blue stacks beta和Note 4。此故障仅出现在注释4中。以下是图纸代码:Java 仅在星系注4上发生的随机闪烁,java,android,android-canvas,samsung-mobile,galaxy,Java,Android,Android Canvas,Samsung Mobile,Galaxy,出于某种原因,我发现了一个毫无意义的小故障,正如我现在所想,它只出现在Galaxy Note 4上。我仅有的测试设备是Nexus 7(2012)、blue stacks beta和Note 4。此故障仅出现在注释4中。以下是图纸代码: if(!started){ continue; } h = getHolder(); if (!h.getSurface().isValid()){ continue;
if(!started){
continue;
}
h = getHolder();
if (!h.getSurface().isValid()){
continue;
}
Canvas c = h.lockCanvas();
c.drawRect(0, 0, this.getWidth(), this.getHeight(), white);
//draw walls
for(int i=0;i<walls.length;i++){
c.drawRect(walls[i].x, walls[i].y, walls[i].bottom, walls[i].right, red);
}
//draw portals
for(int i=0;i<portals.length;i++){
Log.d("S", i+"");
Log.d("S", portalimages[i].toString());
c.drawBitmap(portalimages[i], portals[i].x1, portals[i].y1, null);
c.drawBitmap(portalimages[i], portals[i].x2, portals[i].y2, null);
}
//draw startlocations
for(int i=0;i<startlocations.length;i++){
c.drawBitmap(player, startlocations[i].x, startlocations[i].y, null);
}
//draw checkpoints
for(int i=0;i<checkpoints.length;i++){
c.drawRect(checkpoints[i].x, checkpoints[i].y, checkpoints[i].x+this.getHeight()/18, checkpoints[i].y+this.getHeight()/18, blue);
}
//draw middle line
c.drawRect(0, getHeight()/2-getHeight()/80, getWidth(), getHeight()/2+getHeight()/80, black);
menu.draw(c);
h.unlockCanvasAndPost(c);
注:startlocations设置为startlocations=new Coord[2]代码>
对视频质量感到抱歉。便条4是我爸爸的,所以我必须通过消息服务发送它,它压缩了它,然后YouTube压缩了更多。然后它就变成了这样:
单击播放器开始位置按钮后,没有其他更改。我将尝试更多地了解这一点,但我决定把它张贴在这里,以防我遗漏了什么。谢谢
编辑:
我现在知道,当您没有这一行时,问题就消失了:c.drawBitmap(player,startlocations[I].x,startlocations[I].y,null)代码>这毫无意义。没有错误,并且加载了此代码<代码>位图工厂.decodeResource(getResources(),R.drawable.portal)使用Bitmap.createScaledBitmap(播放器,this.getHeight()/18,this.getHeight()/18,true)调整code>和更高版本代码>我找到了答案,但毫无意义。出于某种原因,就在这个类中,图像需要有透明度,否则会出现小故障。后来我画了其他非透明的图像。这毫无意义,但它是有效的。如果你知道发生这种情况的原因,请告诉我
我的猜测是,在另一个类中,我使用了主包,但在这个类中,它是一个不同的包。这可能就是为什么它只是这个类(或方法)的原因。我得做更多的测试
谢谢
startlocations[location] = new Coord(lastx, lasty);
if(location>0){
location = 0;
}else{
location++;
}
break;