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 ...
随机推荐
- 8.Fluent API in Code-First【Code-First系列】
在前面的章节中,我们已经看到了各种不同的数据注解特性.现在我们来学习一下Fluent API. Fluent API是另外一种配置领域类的方式,它提供了更多的配置相比数据注解特性. Mappings[ ...
- 在Visual Studio中使用正则表达式匹配换行和批量替换
系统环境:Windows 8.1 Enterprise Update 2 x64 开发环境:Mircosoft Visual Studio Ultimate 2013 Update 2 RC 问题:如 ...
- iis 不能访问json文件
我从网上查的资料,解决方案都是设置MIME 映射和“处理脚本映射”. 我按照网上的解决方案执行之后还没有解决我的这个问题,所以我想会不会是其他的原因. 在那么一瞬间,灵光一闪,我把json文件放到新建 ...
- Web API Filter ActionFilterAttribute 使用
WebApi 提供两种过滤器的类型: 1.ActionFilterAttribute 2.exceptionFilterAttribute 两个类都是抽象类,ActionFilter 主要实现执行请求 ...
- 关于JQuery(最后一点动画效果*)
1,$(':radio').val(['1','2','3']);//特殊写法,把值为1 2 3的都选中. 2,math.abs(len)取绝对值 3,按钮高亮显示,一般是配置两个按钮,一个普通的,一 ...
- SUI分页组件和avalon搞定ajax无刷新分页
<div ms-controller="main"> <h2 class="pagination-centered">{{ title ...
- python的metaclass
元类一般用于创建类.在执行类定义时,解释器必须要知道这个类的正确的元类.解释器会先寻找类属性__metaclass__,如果此属性存在,就将这个属性赋值给此类作为它的元类.如果此属性没有定义,它会向上 ...
- int和Integer的区别
int是一种数据类型,Integer是一个类,有各种方法,如Integer.parseInt(string)等.
- 【转】持久化消息队列之MEMCACHEQ
G MEMCACHEQ AS MESSAGE QUEUE PHP,消息队列,MEMCACHEQ 使用消息队列(MESSAGE QUEUE)可以把某些耗时的工作推后,然后在后台慢慢地去执行,这样就不会让 ...
- hibnate 创建表的时候type=innodb报错
这个原因是在MYSQL5.5及以后版本中type=InnoDB 由ENGINE=InnoDB 代替. 解决办法,自己定义一个方言: package com.hotusm.dialect; /** * ...