早教吧 育儿知识 作业答案 考试题库 百科 知识分享

dx=left<0||left>(getWidth()-bitmap.getWidth())-dx:dx;intleft=0;inttop=0;Handlerhandler;intdx=1;intdy=1;dx=left<0||left>(getWidth()-bitmap.getWidth())-dx:dx;dy=top<0||top>(getHeight()-bitmap.g

题目详情
dx = left < 0 || left > (getWidth() - bitmap.getWidth()) -dx :dx;
int left = 0; int top = 0; Handler handler; int dx = 1; int dy = 1; dx = left < 0 || left > (getWidth() - bitmap.getWidth()) -dx :dx; dy = top < 0 || top > (getHeight() - bitmap.getHeight()) -dy :dy;
▼优质解答
答案和解析
dx = left < 0 || left > (getWidth() - bitmap.getWidth()) -dx :dx;
意思就是如果 left < 0或者left > (getWidth() - bitmap.getWidth()) ,那么dx = -dx,否则dx = dx,即不变.
等价于:
if(left < 0 || left > (getWidth() - bitmap.getWidth())){
dx = -dx;
}