android 3d页面跳转

来源:技术人生 责任编辑:栏目编辑 发表时间:2013-07-02 05:12 点击:
package cn.com;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
public class Layout3D extends Activity {
 private int mCenterX = 160;
 private int mCenterY = 0;
 
 private ViewGroup layout1;
 private ViewGroup layout2;
 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle savedInstanceState) {
  
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  
  layout1 = (ViewGroup) findViewById(R.id.layout1);
  Button b1 = (Button) findViewById(R.id.button1);
  b1.setEnabled(true);
  b1.setOnClickListener(new Button.OnClickListener() {
   public void onClick(View v) {
    leftMoveHandle();
    v.setEnabled(false);
   }
  });
 }
 public void jumpToLayout1(Rotate3d leftAnimation) {
  setContentView(R.layout.main);
  layout1 = (ViewGroup) findViewById(R.id.layout1);
  layout1.startAnimation(leftAnimation);
  Button b1 = (Button) findViewById(R.id.button1);
  b1.setEnabled(true);
  b1.setOnClickListener(new Button.OnClickListener() {
   public void onClick(View v) {
    leftMoveHandle();
   }
  });
 }
 public void jumpToLayout2(Rotate3d rightAnimation) {
  setContentView(R.layout.mylayout);
  layout2 = (ViewGroup) findViewById(R.id.layout2);
  layout2.startAnimation(rightAnimation);
  Button b2 = (Button) findViewById(R.id.button2);
  b2.setEnabled(true);
  b2.setOnClickListener(new Button.OnClickListener() {
   public void onClick(View v) {
    rightMoveHandle();
   }
  });
 }
 public void leftMoveHandle() {
  Rotate3d leftAnimation = new Rotate3d(0, -90, 0, 0, mCenterX, mCenterY);
  Rotate3d rightAnimation = new Rotate3d(90, 0, 0.0f, 0.0f, mCenterX, mCenterY);
  leftAnimation.setFillAfter(true);
  leftAnimation.setDuration(1000);
  rightAnimation.setFillAfter(true);
  rightAnimation.setDuration(1000);
  layout1.startAnimation(leftAnimation);
  jumpToLayout2(rightAnimation);
 }
 public void rightMoveHandle() {
  Rotate3d leftAnimation = new Rotate3d(0, 90, 0, 0, mCenterX, mCenterY);
  Rotate3d rightAnimation = new Rotate3d(-90, 0, 0.0f, 0.0f, mCenterX,mCenterY);
  leftAnimation.setFillAfter(true);
  leftAnimation.setDuration(1000);
  rightAnimation.setFillAfter(true);
  rightAnimation.setDuration(1000);
  layout2.startAnimation(rightAnimation);
  jumpToLayout1(leftAnimation);
 }
}
package cn.com;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.view.animation.Animation;
import android.view.animation.Transformation;
public class Rotate3d extends Animation {
 private float mFromDegree;
 private float mToDegree;
 private float mCenterX;
 private float mCenterY;
 private float mLeft;
 private float mTop;
 private Camera mCamera;
 private static final String TAG = "Rotate3d";
 public Rotate3d(float fromDegree, float toDegree, float left

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • Android 完全退出程序
      • 原创:Android应用开发-Andorid歌词秀,含源码
      • android 屏幕保护
      • Android手机软件汉化教程---第四课 dex文件汉化
      • 众多Android 开源项目推荐,给力工作给力学习
      • Android Audio代码分析4
      • Android得到已安装的应用程序信息!
      • Android开发者指南(29) —— USB Host and Accessory
      • Android成长的幕后推手:工程师鲁宾
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1