Android 扒开美女衣服
本文主要实现一个小的扒开美女衣服的游戏项目
效果如下:
项目布局设计:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <ImageView
android:id="@+id/iv_after"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> <ImageView
android:id="@+id/iv_pre"
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> </FrameLayout>
逻辑部分代码:
public class MainActivity extends Activity { private ImageView iv_after;
private ImageView iv_before; private Bitmap alterBitmap;
private Canvas canvas; private Paint paint; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); BitmapFactory.Options opts = new Options();
opts.inSampleSize = 2;
iv_after = (ImageView) findViewById(R.id.iv_after);
iv_before = (ImageView) findViewById(R.id.iv_pre); Bitmap after = BitmapFactory.decodeResource(getResources(),
R.drawable.after19, opts);
Bitmap before = BitmapFactory.decodeResource(getResources(),
R.drawable.pre19, opts); // 可以修改的空白的bitmap
alterBitmap = Bitmap.createBitmap(before.getWidth(),
before.getHeight(), before.getConfig()); canvas = new Canvas(alterBitmap);
paint = new Paint();
paint.setStrokeWidth(5);
paint.setColor(Color.BLACK);
canvas.drawBitmap(before, new Matrix(), paint); iv_after.setImageBitmap(after);
iv_before.setImageBitmap(alterBitmap); iv_before.setOnTouchListener(new OnTouchListener() { @Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: break;
case MotionEvent.ACTION_MOVE:
int newX = (int) event.getX();
int newY = (int) event.getY();
for (int i = -6; i < 6; i++) {
for (int j = -6; j < 6; j++) {
alterBitmap.setPixel(i + newX, j + newY,
Color.TRANSPARENT); }
}
iv_before.setImageBitmap(alterBitmap); break;
case MotionEvent.ACTION_UP: break; default:
break;
} return true;
}
}); } }
Android 扒开美女衣服的更多相关文章
- 开源自己的一个小android项目(美女撕衣服游戏)
这是自己的一个开源自己的一个小android项目(美女撕衣服游戏),也是前6个月开发的,有部分的资源来自网络上的,现在开源出来给大家吧,由于源码比较大,不上传了,我已经上传到源码天堂那个网站那里了,大 ...
- Android应用《撕开美女衣服》的实现过程及源代码
现在很多Android市场中都能找到关于美女的应用,比如 撕开美女衣服.吹裙子等. 这些应用的下载量挺大的,作为Android的开发人员或者一名技术人员我们不能只局限在欣赏应用的层面,很多时候需要我们 ...
- Android小游戏应用---撕破美女衣服游戏
ImageView after; ImageView before; @Override protected void onCreate(Bundle savedInstanceState) { su ...
- Android 实战美女拼图游戏 你能坚持到第几关
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/40595385,本文出自:[张鸿洋的博客] 1.概述 继2048之后,今天给大家带 ...
- Android拼图游戏
效果如下 游戏的设计 首先我们分析下如何设计这款游戏: 1.我们需要一个容器,可以放这些图片的块块,为了方便,我们准备使用RelativeLayout配合addRule实现 2.每个图片的块块,我们准 ...
- Android ToggleButton 实践
在android的开发过程中,对于ToggleButton的使用频率也是相当的高的,下面我就来说一下,这个组件的两种使用方式. 第一种是简单的使用,利用Toast的方式弹出提示语句 需要注意的是要想自 ...
- 必读的 Android 文章
必读的 Android 文章 掘金官方 关注 2017.06.07 13:58* 字数 25218 阅读 8782评论 2喜欢 218 写给 Android 开发者的混淆使用手册 - Android ...
- 推荐xamlspy
xamlspy(http://xamlspy.com/) 如果在win32时代用过spy++的,都应该在silverlight/wpf时代用一下xamlspy,让你重新找到用spy++看别人程序的UI ...
- Android--XML页面的编写
五个页面 代码如下: 图片资源链接: https://pan.baidu.com/s/1jIoTDGE // 第一个 <RelativeLayout xmlns:andr ...
随机推荐
- 可显示Android设备选择列表,并进入指定Android设备Console的Shell脚本
如果PC上连接多部Android设备(包括Android模拟器),在进入Console时还需要使用adb -s deviceid shell.比较麻烦,本文为此编写了一个Shell脚本文件(需要在Li ...
- IOS高级编程之三:IOS 多线程编程
多线程的概念在各个操作系统上都会接触到,windows.Linux.mac os等等这些常用的操作系统,都支持多线程的概念. 当然ios中也不例外,但是线程的运行节点可能是我们平常不太注意的. 例如: ...
- ios基础之 view的frame 与 bounds 的区别 (转)
前言: 学习ios开发有一段时间了,项目也做了两个了,今天看视频,突然发现view的frame和bound两个属性,发现bound怎么也想不明白,好像饶你了死胡同里,经过一番尝试和思考,终于弄明白bo ...
- C#控件及常用设计整
C#控件及常用设计整 1.窗体 1 2.Label 控件 3 3.TextBox 控件 4 4.RichTextBox控件 5 5.NumericUpDown 控件 7 ...
- 激活当前视图菜单高亮呈现 V2.0
前一段时间,Insus.NET有分享一篇<激活当前视图菜单高亮呈现>http://www.cnblogs.com/insus/p/5287093.html 这篇只是同一控制器的菜单. 今天 ...
- asp.net获取站点根目录下子目录的名称
使用Visual Studio建立一个.aspx文件(Web Forms),例如hovertree.aspx,在页面上加入一个ListBox代码如下: <asp:ListBox runat=&q ...
- 创建Oracle数据库
[root@localhost ~]# su - oracle [oracle@localhost ~]$ sqlplus /nolog SQL> conn /as sysdba; SQL> ...
- jquery内容选择器(匹配内容不为空的元素)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Git tag 给当前分支打标签
原文已经找不到出处,重新整理格式,仅作个人收藏! 标签(Tag)可以针对某一时间点的版本做标记,常用于版本发布. 列出tag $ git tag # 在控制台打印出当前仓库的所有tag $ git t ...
- Java ConcurrentModificationException异常原因和解决方法
Java ConcurrentModificationException异常原因和解决方法 在前面一篇文章中提到,对Vector.ArrayList在迭代的时候如果同时对其进行修改就会抛出java.u ...