当前位置: 代码迷 >> Android >> 里面这些i[i][j] 是什么意思跟canvas.drawBit地图(heiZi[1], 12+j*34, 13+i*35, paint);是什么意思求高手解
  详细解决方案

里面这些i[i][j] 是什么意思跟canvas.drawBit地图(heiZi[1], 12+j*34, 13+i*35, paint);是什么意思求高手解

热度:589   发布时间:2016-04-28 03:46:06.0
里面这些i[i][j] 是什么意思跟canvas.drawBitmap(heiZi[1], 12+j*34, 13+i*35, paint);是什么意思求高手解
paint = new Paint();//初始化画笔
public void onDraw(Canvas canvas){//自己写的绘制方法
        canvas.drawColor(Color.WHITE);
        canvas.drawBitmap(background, 0,0, null);//清背景
        canvas.drawBitmap(qiPan, 10, 10, null);//绘制棋盘   
        for(int i=0; i<qizi.length; i++){
            for(int j=0; j<qizi[i].length; j++){//绘制棋子
                if(qizi[i][j] != 0){
                    canvas.drawBitmap(qizibackground, 9+j*34, 10+i*35, null);//绘制棋子的背景                   
                    if(qizi[i][j] == 1){//为黑帅时
                        canvas.drawBitmap(heiZi[0], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 2){//为黑车时
                        canvas.drawBitmap(heiZi[1], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 3){//为黑马时
                        canvas.drawBitmap(heiZi[2], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 4){//为黑炮时
                        canvas.drawBitmap(heiZi[3], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 5){//为黑士时
                        canvas.drawBitmap(heiZi[4], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 6){//为黑象时
                        canvas.drawBitmap(heiZi[5], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 7){//为黑兵时
                        canvas.drawBitmap(heiZi[6], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 8){//为红将时
                        canvas.drawBitmap(hongZi[0], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 9){//为红车时
                        canvas.drawBitmap(hongZi[1], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 10){//为红马时
                        canvas.drawBitmap(hongZi[2], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 11){//为红砲时
                        canvas.drawBitmap(hongZi[3], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 12){//为红仕时
                        canvas.drawBitmap(hongZi[4], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 13){//为红相时
                        canvas.drawBitmap(hongZi[5], 12+j*34, 13+i*35, paint);
                    }
                    else if(qizi[i][j] == 14){//为红卒时
                        canvas.drawBitmap(hongZi[6], 12+j*34, 13+i*35, paint);
                    }
                }
            }
        }

里面这些i[i][j] 是什么意思跟canvas.drawBitmap(heiZi[1], 12+j*34, 13+i*35, paint);是什么意思求高手解释
------解决思路----------------------
java 里的二维数组啊,麻烦你先熟悉一下编程语言先