日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

android图片跳转动画效果,Android实现Activity界面切换添加动画特效的方法

發(fā)布時間:2025/3/21 83 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android图片跳转动画效果,Android实现Activity界面切换添加动画特效的方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

本文以實例形式展示了Android實現(xiàn)Activity界面切換添加動畫特效的方法,對于Android程序設(shè)計人員來說有很好的參考借鑒價值。具體方法如下:

了解Android程序設(shè)計的人應(yīng)該知道,在Android 2.0之后有了overridePendingTransition(),其中里面兩個參數(shù),一個是前一個activity的退出,另一個activity的進入。

現(xiàn)看看下面這段示例代碼:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.SplashScreen);

new Handler().postDelayed(new Runnable() {

public void run() {

Intent mainIntent =new Intent(SplashScreen.this,?? AndroidNews.class);

SplashScreen.this.startActivity(mainIntent);

SplashScreen.this.finish();

overridePendingTransition(R.anim.mainfadein,

R.anim.splashfadeout);

}

},3000);

}

上面的代碼只是閃屏的一部分。

1

getWindow().setWindowAnimations(int);

這可沒有上個好但是也可以 。

實現(xiàn)淡入淡出的效果:

1

overridePendingTransition(Android.R.anim.fade_in,android.R.anim.fade_out);

由左向右滑入的效果:

1

overridePendingTransition(Android.R.anim.slide_in_left,android.R.anim.slide_out_right);

實現(xiàn)zoomin和zoomout,即類似iphone的進入和退出時的效果:

1

overridePendingTransition(R.anim.zoomin, R.anim.zoomout);

新建zoomin.xml文件:

1

2

3

4

5

6

7

8

Android:interpolator="@android:anim/decelerate_interpolator">

Android:fromYScale="2.0" android:toYScale="1.0"

Android:pivotX="50%p" android:pivotY="50%p"

Android:duration="@android:integer/config_mediumAnimTime" />

新建zoomout.xml文件:

1

2

3

4

5

6

7

8

9

10

11

Android:interpolator="@android:anim/decelerate_interpolator"

Android:zAdjustment="top">

Android:fromYScale="1.0" android:toYScale=".5"

Android:pivotX="50%p" android:pivotY="50%p"

Android:duration="@android:integer/config_mediumAnimTime" />

Android:duration="@android:integer/config_mediumAnimTime"/>

相信本文所述示例對大家的Android程序設(shè)計有一定的借鑒價值。

您可能感興趣的文章:

總結(jié)

以上是生活随笔為你收集整理的android图片跳转动画效果,Android实现Activity界面切换添加动画特效的方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。