最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實現(xiàn)Activity界面切換添加動畫特效的方法

 更新時間:2014年08月20日 17:02:35   投稿:shichen2014  
這篇文章主要介紹了Android實現(xiàn)Activity界面切換添加動畫特效的方法,非常實用的技巧,需要的朋友可以參考下

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

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

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

@Override  
public void onCreate(Bundle savedInstanceState) {  
   super.onCreate(savedInstanceState);  
   setContentView(R.layout.SplashScreen);  
   new Handler().postDelayed(new Runnable() {  
    @Override  
    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);  
}  

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

getWindow().setWindowAnimations(int);  

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

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

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

由左向右滑入的效果:

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

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

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

新建zoomin.xml文件:

<?xml version="1.0" encoding="utf-8"?> 
<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> 

新建zoomout.xml文件:

<?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"> 
  <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程序設(shè)計有一定的借鑒價值。

相關(guān)文章

最新評論

三穗县| 阜城县| 钟山县| 巨鹿县| 新和县| 胶南市| 嘉黎县| 吉林省| 桦川县| 阳山县| 建宁县| 淄博市| 富顺县| 新余市| 略阳县| 横山县| 寿光市| 米泉市| 九台市| 伊吾县| 丰都县| 姜堰市| 九台市| 迭部县| 黄陵县| 正阳县| 启东市| 博爱县| 周至县| 昭通市| 安宁市| 隆回县| 安塞县| 南岸区| 邵阳市| 舞阳县| 马尔康县| 五原县| 额尔古纳市| 高要市| 金堂县|