下不了棋。
? private Point getValidPoint(int x, int y) {
? ? ? ? return new Point((int) (x / mLineheight), (int) (y / mLineheight));
? ? }
? //繪制棋盤
? ? @Override
? ? protected void onDraw(Canvas canvas) {
? ? ? ? super.onDraw(canvas);
? ? ? ? drawBoard(canvas);
? ? ? ? drawpieces(canvas);
? ? }
? ? private void drawpieces(Canvas canvas) {
? ? ? ? for(int i=0;i<mWhiteArray.size();i++){
? ? ? ? ? ? Point whitePoint = mWhiteArray.get(i);
? ? ? ? ? ? canvas.drawBitmap(mWhitePiece,
? ? ? ? ? ? ? ? ? ? (whitePoint.x +(1-ratioPieceOfLineHeight)/2)*mLineheight,
? ? ? ? ? ? ? ? ? ? (whitePoint.y +(1-ratioPieceOfLineHeight)/2)*mLineheight,null);
? ? ? ? }
? ? ? ? for(int i=0;i<mBlackArray.size();i++){
? ? ? ? ? ? Point blackPoint = mBlackArray.get(i);
? ? ? ? ? ? canvas.drawBitmap(mBlackPiece,
? ? ? ? ? ? ? ? ? ? (blackPoint.x +(1-ratioPieceOfLineHeight)/2)*mLineheight,
? ? ? ? ? ? ? ? ? ? (blackPoint.y +(1-ratioPieceOfLineHeight)/2)*mLineheight,null);
? ? ? ? }
? ? }
2017-08-06
或者是少寫了什么
2017-08-06
這部分代碼是沒有問題的,應該是你的其他代碼有問題