用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - android代码库

Activity动画效果

2014-04-11 作者: 蹲在牆頭等丶紅杏举报

[android]代码库

网上查找的个人认为是最全的效果,在此记录下,apidemo里也有:
 
package com.iteye.androidtoast;
 
import java.util.ArrayList;
import java.util.List;
 
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
 
public class MainActivity extends Activity {
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
         
        final Spinner mAnimSp = (Spinner) findViewById(R.id.animation_sp);
        Button mButton=(Button) findViewById(R.id.other_button);
         
        // 通过资源文件获取Spinner填充内容
        String[] ls = getResources().getStringArray(R.array.anim_type);
        List<String> list = new ArrayList<String>();
        // 把数组内容填充 到集合
        for (int i = 0; i < ls.length; i++) {
            list.add(ls[i]);
        }
        ArrayAdapter<String> animType = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, list);
        animType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        mAnimSp.setAdapter(animType);
        mAnimSp.setSelection(0);
         
        mButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(MainActivity.this, OtherActivity.class);
                startActivity(intent);
 
                switch (mAnimSp.getSelectedItemPosition()) {
                case 0:
                    /**
                     * 注意:此方法只能在startActivity和finish方法之后调用。
                     * 第一个参数为第一个Activity离开时的动画,
                     * 第二参数为所进入的Activity的动画效果
                     */
                 
                    //淡出淡入效果
                    overridePendingTransition(R.anim.fade, R.anim.hold);
                    break;
                case 1:
                    //放大淡出效果
                    overridePendingTransition(R.anim.my_scale_action,
                            R.anim.my_alpha_action);
                    break;
                case 2:
                    //转动淡出效果
                    overridePendingTransition(R.anim.scale_rotate,
                            R.anim.my_alpha_action);
                    break;
                case 3:
                    //转动淡出效果2
                    overridePendingTransition(R.anim.scale_translate_rotate,
                            R.anim.my_alpha_action);
                    break;
                case 4:
                    //左上角展开淡出效果
                    overridePendingTransition(R.anim.scale_translate,
                            R.anim.my_alpha_action);
                    break;
                case 5:
                    //压缩变小淡出效果
                    overridePendingTransition(R.anim.hyperspace_in,
                            R.anim.hyperspace_out);
                    break;
                case 6:
                    //右往左推出效果
                    overridePendingTransition(R.anim.push_left_in,
                            R.anim.push_left_out);
                    break;
                case 7:
                    //下往上推出效果
                    overridePendingTransition(R.anim.push_up_in,
                            R.anim.push_up_out);
                    break;
                case 8:
                    //左右交错效果
                    overridePendingTransition(R.anim.slide_left,
                            R.anim.slide_right);
                    break;
                case 9:
                    //放大淡出效果
                    overridePendingTransition(R.anim.wave_scale,
                            R.anim.my_alpha_action);
                    break;
                case 10:
                    //缩小效果
                    overridePendingTransition(R.anim.zoom_enter,
                            R.anim.zoom_exit);
                    break;
                case 11:
                    //上下交错效果
                    overridePendingTransition(R.anim.slide_up_in,
                            R.anim.slide_down_out);
                    break;
                }
            }
        });
    }
}
 
转自:http://www.iteye.com/topic/1116472
源码:http://pan.baidu.com/s/1hqBnbQ8(百度云盘)
        http://kuai.xunlei.com/d/Xq15B2zbMWtHUwQA265(迅雷快传)
 
话说这里的分值设置的太贵了 下不起啊


网友评论    (发表评论)

共2 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...