WEB开发网      濠靛倻鏅悵顖涚附閽樺鐎诲ù婊庡亾缁辨帗鎷呴悩鍨暠濞戞挴鍋撳ù鐘烘閸ㄥ孩绂嶉锝喰﹂柟瀛樺灣濠婃垿鎯冮崟顏嗩伇濞寸姾妫勬慨鈺呭礉濞戝磭骞㈤悹鍥у槻閸ㄥ孩绂嶉敓锟� ---闁挎洩鎷�
开发学院手机开发Android 开发 Android编程之“捏泡泡”游戏 阅读

Android编程之“捏泡泡”游戏

 2010-08-23 01:06:00 来源:WEB开发网 闁靛棴鎷�闁告垵绻愰惃顒傗偓娑欍仦缂嶏拷濠⒀呭仜閵囧洨鈧稒銇炵紞锟�闁靛棴鎷�  闁稿繗娅曢弫鐐垫嫬闁垮鈧秹鏌ㄧ€靛憡鐣辩€甸偊鍠栧畷锟�
核心提示:public boolean onOptionsItemSelected(MenuItem item) {switch (item.getItemId()) {case 0:reset();return false;case 1:about();return false;case 2:destory();return

public boolean onOptionsItemSelected(MenuItem item) {

switch (item.getItemId()) {

case 0:

reset();

return false;

case 1:

about();

return false;

case 2:

destory();

return false;

default:

return false;

}

}

public void onBackPressed(){

destory();

super.onBackPressed();

}

/**

* 重新开始

*/

public void reset(){

int i,l=vcl.length;

for(i=0;i

vcl[i].reset();

}

}

/**

* 销毁对象,释放资源

*/

public void destory(){

sound.destroy();

this.finish();

}

/**

* 初始化每一行的泡泡

*/

private void initRows(){

int i,l=rowCount;

TableLayout container=(TableLayout)findViewById(R.id.container2);

for(i=0;i

rows[i]=new TableRow(this);

container.addView(rows[i]);

}

}

/**

* 初始化内容的呈现

*/

private void initRender(){

int cr,i,l=vcl.length;

initRows();

for(i=0;i

cr=(int)Math.ceil(i/cellCount);

vcl[i]=new Vacuole(this,sound);

rows[cr].addView(vcl[i].renderer, 46, 46);

}

}

/**

* about对话框的定义

*/

private void about(){

Dialog dialog = new Dialog(this);

dialog.setContentView(R.layout.about);

dialog.setTitle("随机出品");

dialog.show();

}

}

Vacuole类

package randork.game;

import android.content.Context;

import android.view.MotionEvent;

import android.view.View;

上一页  1 2 3 4  下一页

Tags:Android 编程 泡泡

编辑录入:coldstar [复制链接] [打 印]
赞助商链接