Android翻页效果,电子书
相信做电子书的同学,都遇到过翻页动画的需求吧,如果你不满足与点击滑动翻页的话,这边文章应该能够帮助到你。
先上个效果图:
效果还是很不错的,不过与ibook那个效果比起来,还是有差距的。应为这个没用到openGL做3D效果,只是用的2d的canvas画布去画的view,添加了阴影效果,还是挺有立体感的。而且比较流畅。openGL实现肯定效果会更好,不过就我目前的技术实力,实现希望还是渺茫的。
废话少说,还是上代码吧:
这里需要两个UI的view类和一个使用方法的demo。
第一个pageTurnerView.java:
Java代码
public class PageTurnerViewP1 extends RelativeLayout{
private static final int CORNER_RIGHT_MASK = 1;
private static final int CORNER_TOP_MASK = 2;
public static final int CORNER_BOTTOM_LEFT = 0;
public static final int CORNER_BOTTOM_RIGHT = 1;
public static final int CORNER_TOP_LEFT = 2;
public static final int CORNER_TOP_RIGHT = 3;
private static final int INVALIDATE = 1;
private static final int INITIAL_TIME_DELAY = 100;
private static final int TIME_DELAY = 10;
// private static final int TIME_STEPS = 30;
private boolean mPageTurning;
private boolean mStepping;
public long mNextTime;
private int mTimeStep;
private int mDrawnTimeStep;
private int mCorner;
private Drawable mBackPage;
private Drawable mPageBackground;
private Path mForegroundPath;
private Path mBackPagePath;
private Path mBackgroundPath;
private float mRotation;
private Rect mChildRect = new Rect();
相关新闻>>
- 发表评论
-
- 最新评论 更多>>