资源简介
android 幻灯片效果,android 幻灯片效果
代码片段和文件信息
package com.open.turnpage;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Rect;
import android.view.SurfaceHolder;
/**
*
* @author yanglonghui
*
*/
public class BlackSquareFadeAway implements ITurnPage {
private int duration=850;//动画持续时间
private final int leafNum=5;
private PaintFlagsDrawFilter pdf=new PaintFlagsDrawFilter(0 Paint.ANTI_ALIAS_FLAG|Paint.FILTER_BITMAP_FLAG);
public BlackSquareFadeAway() {
// TODO Auto-generated constructor stub
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
}
@Override
public void onTurnPageDraw(SurfaceHolder holder Bitmap[] bitmap
int maxWidth int maxHeight) {
int dx=(maxWidth-bitmap[0].getWidth())/2;
int dy=(maxHeight-bitmap[0].getHeight())/2;
int perWidth=maxWidth/leafNum;
int row=maxHeight/perWidth;
int perHeight=maxHeight/row;
Rect[][] array=new Rect[row][leafNum];
for(int i=0;i {
for(int j=0;j {
array[i][j]=new Rect();
array[i][j].set(j*perWidth i*perHeight (j+1)*perWidth (i+1)*perHeight);
if(j==array[i].length-1)
{
array[i][j].set(maxWidth-perWidth array[i][j].top maxWidth array[i][j].bottom);
}
if(i==array.length-1)
{
array[i][j].set(array[i][j].left maxHeight-perHeight array[i][j].right maxHeight);
}
}
}
long start=System.currentTimeMillis();
long runMills=0;
Paint mRectPaint=new Paint();
mRectPaint.setColor(Color.BLACK);
Rect drawRect=new Rect();
Canvas canvas=null;
boolean isRunning=true;
while(isRunning)
{
isRunning=((runMills=(System.currentTimeMillis()-start)) if(!isRunning)
{
runMills=duration;
}
try {
canvas=holder.lockCanvas(null);
canvas.setDrawFilter(pdf);
canvas.drawColor(Color.BLACK);// 清除画布
if(!isRunning)
{
canvas.drawBitmap(bitmap[0] dx dy null);
}
else
{
canvas.save();
canvas.translate(dx dy);
for(int i=0;i {
for(int j=0;j {
drawRect.set(array[i][j]);
int _dx = drawRect.width()/2-(int)(((float)runMills/(float)duration)*drawRect.width()/2);
int _dy = drawRect.height()/2-(int)(((float)runMills/(float)duration)*drawRect.height()/2);
drawRect.inset(_dx _dy);
canvas.drawBitmap(bitmap[0] drawRect drawRect null);
}
}
canvas.restore();
}
} catch (Exception e) {
e.printStackTrace();
}finally{
if(null!=canvas)
{
holder.unlockCanvasAndPost(canvas);
}
else
{
break;
}
if(!isRunning)
{
break;
}
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-12-14 15:24 android-turnpage-master\
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\
文件 475 2013-12-14 15:24 android-turnpage-master\git_turnpage\.classpath
文件 848 2013-12-14 15:24 android-turnpage-master\git_turnpage\.project
文件 481 2013-12-14 15:24 android-turnpage-master\git_turnpage\AndroidManifest.xm
文件 781 2013-12-14 15:24 android-turnpage-master\git_turnpage\proguard-project.txt
文件 584 2013-12-14 15:24 android-turnpage-master\git_turnpage\project.properties
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-hdpi\
文件 9397 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-hdpi\ic_launcher.png
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-mdpi\
文件 5237 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-mdpi\ic_launcher.png
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-xhdpi\
文件 14383 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\drawable-xhdpi\ic_launcher.png
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values-v11\
文件 334 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values-v11\st
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values-v14\
文件 391 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values-v14\st
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values\
文件 82 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values\strings.xm
文件 697 2013-12-14 15:24 android-turnpage-master\git_turnpage\res\values\st
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\
目录 0 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\
文件 3108 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\BlackSquareFadeAway.java
文件 2898 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\BlackSquareZoomIn.java
文件 381 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\ITurnPage.java
文件 2064 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\ShutterDown2Up.java
文件 2194 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\ShutterLeft2Right.java
文件 1992 2013-12-14 15:24 android-turnpage-master\git_turnpage\src\com\open\turnpage\ShutterRight2Left.java
............此处省略38个文件信息
- 上一篇:C#调用Java接口演示
- 下一篇:Java版终端 Demo
相关资源
- zgf游戏框架搭建
- Transparent Proxy.apk
- Android蓝牙连接传输文件Demo
- android动态添加布局,并获得组件的监
- Android自定义显示内容的Dialog
- Android平台的即时通信系统客户端设计
- Android用Canvas画曲线图并动态更新数据
- android学生信息管理软件源代码
- 简易android聊天工具
- HttpClient for android 4 3 5 jar
- android版学生信息管理系统
- android 移动地图
- android课程设计
- android-studio-bundle-135.1740770-windows官网最
- Android 自定义控件 EditText输入框两边加
- Android studio aidl小demo
- 简单的android闹钟源代码
- 简单的记事本android应用源代码
- android好看的倒计时圆形控件
- android 火车票查询源代码
- android截屏源码
- 有关Android中从图库或拍照获取头像并
- Android项目实战--通讯录
- Android-Delphi开发蓝牙官方解析(XE10+小
- Android之利用WebBrowser实现浏览器
- Android之程序界面内截取屏幕
- 自己做的android通讯录
- Retrofit2最新视频教程
- android开机自动启动service
- Android 备份(提取)apk
评论
共有 条评论