开发工具:
文件大小: 102kb
下载次数: 0
上传时间: 2013-10-30
详细说明: 基于android的贪吃蛇开发 public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // No Title bar requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.snake_layout); mSnakeView = (SnakeView) findViewById(R.id.snake); mSnakeView.setTextView((TextView) findViewById(R.id.text)); play = (Button)findViewById(R.id.play); play.setId(PLAY); play.setOnClickListener(this); play.setBackgroundColor(Color.argb(0, 0, 255, 0)); left = (ImageButton)findViewById(R.id.left); left.setId(LEFT); left.setOnClickListener(this); left.setBackgroundColor(Color.argb(1, 1, 255, 1)); left.setVisibility(View.GONE); right = (ImageButton)findViewById(R.id.right); right.setId(RIGHT); right.setOnClickListener(this); right.setBackgroundColor(Color.argb(1, 1, 255, 1)); right.setVisibility(View.GONE); up = (ImageButton)findViewById(R.id.up); up.setId(UP); up.setOnClickListener(this); up.setBackgroundColor(Color.argb(1, 1, 255, 1)); up.setVisibility(View.GONE); down = (ImageButton)findViewById(R.id.down); down.setId(DOWN); down.setOnClickListener(this); down.setBackgroundColor(Color.argb(1, 1, 255, 1)); down.setVisibility(View.GONE); if (savedInstanceState == null) { // We were just launched -- set up a new game mSnakeView.setMode(mSnakeView.READY); } else { // We are being restored Bundle map = savedInstanceState.getBundle(ICICLE_KEY); if (map != null) { mSnakeView.restoreState(map); } else { mSnakeView.setMode(SnakeView.PAUSE); } } handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case Snake.GUINOTIFIER: play.setVisibility(View.VISIBLE); left.setVisibility(View.GONE); right.setVisibility(View.GONE); up.setVisibility(View.GONE); down.setVisibility(View.GONE); break; } super.handleMessage(msg); } }; } @Override protected void onPause() { super.onPause(); // Pause the game along with the activity mSnakeView.setMode(SnakeView.PAUSE); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.