工作之余,对android颇有兴趣,只是武汉从事android的企业貌似不多,所有自学着玩一下,就坐个简单的拼图游戏,只当实验一下

简单的功能有 查找手机或sd卡的图片,等比缩放,分割,乱序,排列

还有再次点选择图片的时候,会记录图片所属目录(免得每次从根目录开始找)











部分代码(其实我用的最土的办法,一个小图片记录两个坐标,一个是原始的,一个是随机的,最后判断每个小图片的 这两个坐标是否一致,如果都相同,则 Game Over)

public synchronized void check(){boolean over = true;for(BitmapView  bitmapView : bitmapViewList){    if(bitmapView.getX() != bitmapView.getRandomX() || bitmapView.getY() != bitmapView.getRandomY()){    over = false;    isContinue = true;    isOver = false;    break;    }        }if(over){    isContinue = false;    isOver = true;    Message msg = new Message();    Bundle bundle = new Bundle();    bundle.putBoolean("isOver", isOver);    msg.setData(bundle);    GameViewActivity.this.handler.sendMessage(msg);}}class BitmapView{    Bitmap bitmap;    int x;    int y;    int randomX;    int randomY;public BitmapView(Bitmap bitmap, int x, int y) {super();this.bitmap = bitmap;this.x = x;this.y = y;}public Bitmap getBitmap() {return bitmap;}public void setBitmap(Bitmap bitmap) {this.bitmap = bitmap;}public int getX() {return x;}public void setX(int x) {this.x = x;}public int getY() {return y;}public void setY(int y) {this.y = y;}public int getRandomX() {return randomX;}public void setRandomX(int randomX) {this.randomX = randomX;}public int getRandomY() {return randomY;}public void setRandomY(int randomY) {this.randomY = randomY;}    }

更多相关文章

  1. Android学习小Demo(5)结合Matrix跟Porperty Animatin 实现推拉门效
  2. 【Android】多图选择器(支持图片预览 高效加载不怕OOM)
  3. Android之ListView异步加载图片且仅显示可见子项中的图片
  4. Android使用PowerImageView实现播放强大的ImageView动画效果
  5. android 修改电量图标(改为数字图标)
  6. Android中图片压缩方案详解及源码下载
  7. Android(安卓)drawable resource error:No resource found that m
  8. Android中利用ContentResolver获取本地音乐和相片
  9. Android(安卓)自定义View界面大合集

随机推荐

  1. Android为Layout设置最大宽度
  2. 萝卜小姐-Handler之系列sendMessage学习
  3. Android收起虚拟键盘
  4. android 云标签,文字墙(文字随机排列效果)
  5. Android SDK 1.5 "--core-library" build
  6. Android通用生命周期
  7. Android的定位策略
  8. cocos2d-x打开网页android与ios平台
  9. android2.1获得联系人信息+Android 获取
  10. android sdk content loader 加载很慢的