Android activity跳转动画,6种activity进入动画

源码链接:https://pan.baidu.com/s/1jAKMNUuCdWVxUm2BUCzL2g

 

添加动画anim

新activity进入方式

默认是右往左进入动画

1、下往上推进入动画——100与-100互换即可——上往下推进入动画

in:

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><translateandroid:duration="700"android:fromYDelta="100%p"android:toYDelta="0" /><alphaandroid:duration="700"android:fromAlpha="0.0"android:toAlpha="1.0" />
</set>

out:

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"><translateandroid:duration="700"android:fromYDelta="0"android:toYDelta="-100%p" /><alphaandroid:duration="700"android:fromAlpha="1.0"android:toAlpha="0.0" />
</set>

2、左往右进入动画

in:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"><translateandroid:duration="2000"android:fromXDelta="-100%p"android:toXDelta="0" />
</set>

out:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"><translateandroid:duration="2000"android:fromXDelta="0"android:toXDelta="100%p" />
</set>

3、透明淡出,中间缩放进入动画

in:

<?xml version="1.0" encoding="utf-8"?><!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"><scaleandroid:duration="1000"android:fillAfter="false"android:fromXScale="0.0"android:fromYScale="0.0"android:interpolator="@android:anim/accelerate_decelerate_interpolator"android:pivotX="50%"android:pivotY="50%"android:toXScale="1"android:toYScale="1" />
</set>

out:

<?xml version="1.0" encoding="utf-8"?><!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"><alphaandroid:duration="1000"android:fromAlpha="1.0"android:toAlpha="0" /></set>

4、透明淡出,左上角放大进入动画

in:

<?xml version="1.0" encoding="utf-8"?><!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"android:shareInterpolator="false"><scaleandroid:duration="1000"android:fromXScale="0.0"android:fromYScale="0.0"android:interpolator="@android:anim/decelerate_interpolator"android:pivotX="0"android:pivotY="0"android:repeatCount="0"android:startOffset="0"android:toXScale="1.0"android:toYScale="1.0"></scale></set>

out:......

5、组合动画,旋转,缩放,移动

<?xml version="1.0" encoding="utf-8"?><!-- android:duration="@android:integer/config_mediumAnimTime" -->
<set xmlns:android="http://schemas.android.com/apk/res/android"android:shareInterpolator="false"><scaleandroid:duration="2000"android:fromXScale="0.0"android:fromYScale="0.0"android:interpolator="@android:anim/decelerate_interpolator"android:pivotX="50%"android:pivotY="50%"android:toXScale="1.0"android:toYScale="1.0"></scale><translateandroid:duration="2000"android:fromXDelta="120"android:fromYDelta="30"android:interpolator="@android:anim/accelerate_decelerate_interpolator"android:toXDelta="30"android:toYDelta="250" /><rotateandroid:duration="2000"android:fromDegrees="0"android:interpolator="@android:anim/accelerate_decelerate_interpolator"android:pivotX="50%"android:pivotY="50%"android:toDegrees="+355" />
</set>

6、左上角退出,外围缩放进入动画

in:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/decelerate_interpolator"><alphaandroid:duration="1000"android:fromAlpha="0"android:toAlpha="1.0" /><scaleandroid:duration="1000"android:fromXScale="2.0"android:fromYScale="2.0"android:pivotX="50%p"android:pivotY="50%p"android:toXScale="1.0"android:toYScale="1.0" />
</set>

out:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"android:interpolator="@android:anim/decelerate_interpolator"android:zAdjustment="top"><scaleandroid:duration="2000"android:fromXScale="1.0"android:fromYScale="1.0"android:pivotX="0"android:pivotY="0"android:toXScale="0"android:toYScale="0" /><alphaandroid:duration="2000"android:fromAlpha="1.0"android:toAlpha="0" />
</set>

 

activity实现跳转动画代码

 

private Context mContext;
mContext = MainActivity.this;
 
startView.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {Intent intent = new Intent(mContext, MyTwoActivity.class);mContext.startActivity(intent);((Activity)mContext).overridePendingTransition(R.anim.zoom_enter,R.anim.zoom_exit);}
});

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/415556.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Jmeter日志输出和日志级别设置

Jmeter运行出现问题可以通过调整jmeter的日志级别定位问题&#xff0c;但运行测试时建议关闭jmeter日志&#xff0c;jmeter打印日志耗费系统性能。 Jmeter日志默认存放在%JMeter_HOME%\bin目录&#xff0c;文件名通常是JMeter.log。日志记录与JMeter本身运行有关的日志信息。 J…

exposed beyond app through Intent.getData(),或FileUriExposedException

Android7.0及以上版本拍照报错 exposed beyond app through Intent.getData()&#xff0c;或FileUriExposedException 解决方法&#xff1a; 在Application的onCreat()方法中添加以下代码&#xff1a; // android 7.0系统解决拍照的问题 StrictMode.VmPolicy.Builder builde…

未获取root手机抓包方法

没有root的android不能使用类似shark的APP抓包&#xff0c;以下两个不root抓包的方法供参考 未获取root的Android手机抓包方法1&#xff1a;连接PC开启的WIFI PC开启WIFI热点共享&#xff0c;然后手机连接到此虚拟WIFI&#xff0c;pc上使用wireshark选择对应网卡抓包。 win7以上…

栈的应用--迷宫问题

问题描述&#xff1a;给定一个迷宫&#xff0c;给定入口和出口&#xff0c;找到从入口到出口的一条路径(任何一条路径都可以)&#xff0c;迷宫为0表示可走&#xff0c;为1表示墙。用1将迷宫围起来避免边界问题。 实现思路&#xff1a;1.DFS搜索&#xff08;递归&#xff09; 2.…

小程序 mpvue 生命周期一览

// vue 生命周期 beforeCreate () {console.log(vue [page-blog] beforeCreate) }, created () { console.log(vue [page-blog] created) }, beforeMount () { console.log(vue [page-blog] beforeMount) }, mounted () { console.log(vue [page-blog] mounted) }, beforeU…

工作129:动态路由

routes() {/*获取数据里面的控制业务端和营销端的mode数值*/const property Vue.ls.get(ACCESS_MODE);/*const *//* const showingMenu staticRoutes.filter(item){return !item.hidden}*//*去除里面的不是item.hidden是隐藏的属性*/const showingMenu staticRoutes.filte…

fragment dispatchTouchEvent

在父activity添加如下代码即可Override public boolean dispatchTouchEvent(MotionEvent ev) {if (ev.getAction() MotionEvent.ACTION_DOWN) {View v getCurrentFocus();if (isShouldHideKeyboard(v, ev)) {hideKeyboard(v.getWindowToken());}}return super.dispatchTouchE…

mpvue 微信小程序 显示 转发按钮

在js中定义 showShareMenu 函数&#xff0c;页面右上角就会出现转发的按钮。 官方文档 https://developers.weixin.qq.com/miniprogram/dev/api/share.html 具体想在哪个页面增加转发的按钮&#xff0c;就添加下面的代码 mounted() {wx.showShareMenu(); },这只是最简单的增加…

目录遍历漏洞

“目录遍历漏洞”指通过在URL或参数中构造“../”&#xff0c;或“../”和类似的跨父目录字符串的ASCII编码、unicode编码等&#xff0c;完成目录跳转&#xff0c;读取操作系统各个目录下的敏感文件&#xff0c;也可以称作“任意文件读取漏洞”。 ../ ..%2F /%c0%ae%c0%ae/ %2e…

!--[if IE 9] ![endif]--

<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--><!--[if IE]> 所有的IE可识别 <![endif]--><!--[if IE 6]> 仅IE6可识别 <![endif]--><!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]--><!--[if gte …

Android 将图片网址url转化为bitmap,drawable转bitmap,file转bitmap,bitmap转file,Bitmap转String,Uri转Bitmap

file转bitmap File param new File(); Bitmap bitmap BitmapFactory.decodeFile(param.getPath(&#xff09;); drawable转bitmap Bitmap bmp BitmapFactory.decodeResource(getResources(),R.mipmap.jcss_03 ); url转bitmap Bitmap bitmap; public Bitmap returnBitMa…

小程序 web-view 打开 微信公众号文章

首先微信小程序不能不能随便打开一个网址就能进行访问。 必须要配置业务域名。 但是&#xff0c;如果小程序和微信公众号进行了关联&#xff0c;则直接可以打开这个公众号到文章。 我已经测试过了。肯定好用。 还有一种方案&#xff0c;打开别人公众号的文章&#xff0c;你…

IP协议包中的TTL(Time-To-Live)

TTL(Time-To-Live)的作用是限制数据包在网络中存在的时间&#xff0c;防止数据包不断的在IP互联网络上循环。 TTL指定数据包被路由器丢弃之前允许通过的最大网段数量&#xff0c;是IP数据包在网络中可以转发的最大跳数(跃点数)&#xff0c;TTL位于IPv4包的第9个字节&#xff0c…

常用的方法论-PARR

转载于:https://www.cnblogs.com/qjm201000/p/7687470.html

小程序 自定义遮照 mask 禁止上下滑动

要写一个提示框&#xff0c;有灰度&#xff0c;放到正常页面最外层。发现上下滑动&#xff0c;里层的页面也会跟着上下动&#xff0c;其实只需要再设置一下page的属性就行了。 <style lang"less" scoped>.verify-mask {z-index: 99999;position: fixed;top: 0…

修改wireshark协议解析规则

不同的协议有不同的解码器,wireshark尝试为每个包尝试找到正确的解码器,特定的情况有可能会选择错误的解码器。 1.使用了其它协议的标准端口&#xff0c;被错误解码&#xff0c;使用udp的80端口发送数据被当作QUIC协议解析。 wireshark菜单“Analyze–>Enabled Protocols…”…

java 泛型类使用,集合中添加不同类型数据

添加 ArrayList<String> a new ArrayList<String>(); a.add("CSDN_SEU_Cavin"); Class c a.getClass(); try{Method method c.getMethod("add",Object.class);method.invoke(a,100);System.out.println("lgqname:" a); }catch(Ex…