99偷拍视频精品区一区二,口述久久久久久久久久久久,国产精品夫妇激情啪发布,成人永久免费网站在线观看,国产精品高清免费在线,青青草在线观看视频观看,久久久久久国产一区,天天婷婷久久18禁,日韩动漫av在线播放直播

Android中Animation資源有哪些

本篇內(nèi)容介紹了“Android中Animation資源有哪些”的有關(guān)知識(shí),在實(shí)際案例的操作過(guò)程中,不少人都會(huì)遇到這樣的困境,接下來(lái)就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!

普洱網(wǎng)站建設(shè)公司成都創(chuàng)新互聯(lián),普洱網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為普洱成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的普洱做網(wǎng)站的公司定做!

SDK中的示例程序App->Activity->Animation演示了切換Activity時(shí)的動(dòng)畫效果。提供了兩種動(dòng)畫效果,一種是Fade In漸變,后出現(xiàn)的Activity由淺入深逐漸顯示;另一種是Zoom放大效果,后出現(xiàn)的Activity由小及大逐漸顯示。

Android中Animation資源有哪些

Android 中 Animation 資源可以分為兩種:

Tween Animation 對(duì)單個(gè)圖像進(jìn)行各種變換(縮放,平移,旋轉(zhuǎn)等)來(lái)實(shí)現(xiàn)動(dòng)畫。

Frame Animation 由一組圖像順序顯示顯示動(dòng)畫。

Animation 中使用的是Tween Animation,使用的資源為R.anim.fade、R.anim.hold、R.anim.zoom_enter、R.anim.zoom_exit。

其中R.anim.fade、R.anim.zoom_enter分別為Fade In 和 Zoom動(dòng)畫資源。其定義為:

fade.xml

<alpha xmlns:android=”http://schemas.android.com/apk/res/android”    android:interpolator=”@android:anim/accelerate_interpolator”    android:fromAlpha=”0.0&Prime; android:toAlpha=”1.0&Prime;    android:duration=”@android:integer/config_longAnimTime” />

zoom_center.xml

<set xmlns:android=”http://schemas.android.com/apk/res/android”    android:interpolator=”@android:anim/decelerate_interpolator”>   <scale android:fromXScale=”2.0&Prime; android:toXScale=”1.0&Prime;     android:fromYScale=”2.0&Prime; android:toYScale=”1.0&Prime;     android:pivotX=”50%p” android:pivotY=”50%p”     android:duration=”@android:integer/config_mediumAnimTime” />   </set>

tween animation 資源定義的格式如下:

<?xml version=”1.0&Prime; encoding=”utf-8&Prime;?>    <set xmlns:android=”http://schemas.android.com/apk/res/android”     android:interpolator=”@[package:]anim/interpolator_resource”     android:shareInterpolator=[ ” true ” false “>    <alpha    android:fromAlpha=”float”     android:toAlpha=”float” />    <scale    android:fromXScale=”float”     android:toXScale=”float”     android:fromYScale=”float”     android:toYScale=”float”     android:pivotX=”float”     android:pivotY=”float” />    <translate    android:fromXDelta=”float”     android:toXDelta=”float”     android:fromYDelta=”float”     android:toYDelta=”float” />    <rotate    android:fromDegrees=”float”     android:toDegrees=”float”     android:pivotX=”float”     android:pivotY=”float” />    <set> &hellip;     </set>    </set>

<set> 為其它animation類型<alpha>,<scale>,<translate>和<rotate>或其它<set>的容器。

android:interpolator 為Interpolator資源ID,Interpolator定義了動(dòng)畫的變化速率,動(dòng)畫的各幀的顯示可以加速,減速,重復(fù)顯示。

android:shareInterpolator 如果想為<set>中的各個(gè)子動(dòng)畫定義共享interpolator,shareInterpolator 則設(shè)為true。

<alpha> 定義Fade in 、Fade out 動(dòng)畫,其對(duì)應(yīng)的Android類AlphaAnimation,參數(shù)由fromAlpha,toAlpha定義。

<scale>定義縮放動(dòng)畫,其對(duì)應(yīng)的Android類為ScaleAnimation,參數(shù)由fromXScale、toXScale、 fromYScale、toYScale、pivotX、pivotY定義,pivotX、pivotY定義了縮放時(shí)的中心。

<translate>定義平移動(dòng)畫,其對(duì)應(yīng)的Android類為TranslateAnimation,參數(shù)由fromXDelta、toXDelta、fromYDelta、toYDelta定義。

<rotate>定義選擇動(dòng)畫,其對(duì)應(yīng)的Android類RotateAnimation,參數(shù)由fromDegrees、toDegrees、pivotX、pivotY, pivotX、pivotY定義選擇中心。

Animation中的Fade In和Zoom In按鈕的事件處理代碼:

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);     }    };   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);     }    };

從代碼可以看到Activity Animation到其它Activity Controls1  切換的動(dòng)畫使用overridePendingTransition 來(lái)定義,函數(shù)overridePendingTransition(int  enterAnim, int exitAnim) 必須定義在StartActivity(Intent) 或是  Activity.finish()之后來(lái)定義兩個(gè)Activity切換時(shí)的動(dòng)畫,enterAnim  為新Activity出現(xiàn)時(shí)動(dòng)畫效果,exitAnim則定義了當(dāng)前Activity退出時(shí)動(dòng)畫效果。

“Android中Animation資源有哪些”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識(shí)可以關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實(shí)用文章!

分享標(biāo)題:Android中Animation資源有哪些
轉(zhuǎn)載注明:http://www.yijiale78.com/article8/pcssip.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站企業(yè)建站電子商務(wù)做網(wǎng)站微信公眾號(hào)虛擬主機(jī)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

營(yíng)銷型網(wǎng)站建設(shè)