public class Animation extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_animation);
// Watch for button clicks.
Button button = (Button)findViewById(R.id.fade_animation);
button.setOnClickListener(mFadeListener);
button = (Button)findViewById(R.id.zoom_animation);
button.setOnClickListener(mZoomListener);
}
private OnClickListener mFadeListener = new OnClickListener() {
public void onClick(View v) {
// Request the next activity transition (here starting a new one).
startActivity(new Intent(Animation.this, Controls1.class));
// Supply a custom animation. This one will just fade the new
// activity on top. Note that we need to also supply an animation
// (here just doing nothing for the same amount of time) for the
// old activity to prevent it from going away too soon.
overridePendingTransition(R.anim.fade, R.anim.hold);
API Level 5
Parameters
enterAnim
A resource ID of the animation resource to use for the incoming activity.
Use 0 for no animation. |
exitAnim
A resource ID of the animation resource to use for the outgoing activity.
Use 0 for no animation. |
}
};
private OnClickListener mZoomListener = new OnClickListener() {
public void onClick(View v) {
// Request the next activity transition (here starting a new one).
startActivity(new Intent(Animation.this, Controls1.class));
// This is a more complicated animation, involving transformations
// on both this (exit) and the new (enter) activity. Note how for
// the duration of the animation we force the exiting activity
// to be Z-ordered on top (even though it really isn't) to achieve
// the effect we want.
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
}
};
}
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_longAnimTime" />
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:zAdjustment="top">
<scale android:fromXScale="1.0" android:toXScale=".5"
android:fromYScale="1.0" android:toYScale=".5"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
<alpha android:fromAlpha="1.0" android:toAlpha="0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
分享到:
相关推荐
android ApiDemo android ApiDemo
android apidemo.apk
android sdk中拿出来的 android api demo,sdk\samples\android-17,给需要的人
关于apidemo的例子,里面的例子非常的不错啊
Google官方API(Android ApiDemo) 打包下载,初学者学习的捷径
android apidemo android apidemo android apidemo
Android官方apidemo,android studio直接导入,运行安装即可
android APIdemo 深入分析
android中文apidemo详解事例,适合新手阅读快速上手。
腾讯微博APIDemo aip sdk
android 示例源码 apidemo 内容很全的,直接导入即可使用学习
最新6.0,最新APIDEMO
在SpringBoot中应用swagger2的一个DEMO,主要功能包括:WEB访问API,API导出为adoc、html、pdf。项目中有中文字体文件,使用的时候先删除目录docs、html和pdf目录,启动项目,然后点击...可方便的移植到自己的项目中。
百度地图API使用,及Demo。一套应用程序接口,帮助开发者构建功能丰富、交互性强的地图应用程序。 JavaScript API Mobile API Web Services Flash API 导航控件 缩略图控件 地图类型控件 比例尺控件 ...
把Android Apidemo第一个例子抽出来,以后每学一节就加进Apidemo框架里,加深理解
Android2.3ApiDemo
android 高德 地图apiDemo
学习android 的sample apidemo 以后要用到这些例子 方便自己方便别人