Android攻城獅四種基礎動畫

來源:互聯網
上載者:User

標籤:透明度   表示   load   imageview   --   erp   oid   xml檔案   四種   

AlphaAnimation(透明動畫)1.xml檔案<set xmlns:android="http://schemas.android.com/apk/res/android">    <!-- 漸層動畫,表示從透明度10%到100%,期間為1秒 --><alpha     android:fromAlpha="0.1"    android:toAlpha="1"    android:duration="1000"    ></alpha></set>2.代碼Animation animation;//動畫對象animation=AnimationUtils.loadAnimation(this, R.anim.alpha); //將動畫載入進來mImageView.startAnimation(animation);//imageView開始動畫,參數為設定好的動畫


ScaleAnimation(縮放動畫)xml檔案<set xmlns:android="http://schemas.android.com/apk/res/android" >    <!--     interpolator //插入器,比如這個設定是先加速,後減速。    android:pivotX="0.1" 設定錨點x的座標。表示從該座標開始放大     -->    <scale        android:duration="1000"        android:fromXScale="1"        android:fromYScale="0.1"        android:interpolator="@android:anim/accelerate_decelerate_interpolator"        android:pivotX="0.1"        android:pivotY="50%"        android:toXScale="1.0"        android:toYScale="1.0" >    </scale></set>


TranslateAnimation(位移動畫)<set xmlns:android="http://schemas.android.com/apk/res/android">    <!--     android:fromXDelta="0" //表示從x哪個位置開始,如果是0,就是當前位置      android:toXDelta="100" //表示到x哪個位置結束     Delta  【數學】(變數的)增量     -->    <translate        android:fromXDelta="0"        android:toXDelta="100"        android:fromYDelta="0"        android:toYDelta="100"        android:duration="1000"        ></translate></set>


RotateAnimation(旋轉動畫)<set xmlns:android="http://schemas.android.com/apk/res/android">    <!--          android:fromDegrees="0" 表示從0度開始旋轉         android:toDegrees="-720" 表示“逆時針”旋轉兩圈(720度),如果是“+720”,則為順時針旋轉720度     -->    <rotate        android:fromDegrees="0"        android:toDegrees="-720"        android:pivotX="0"        android:pivotY="0"        android:interpolator="@android:anim/accelerate_decelerate_interpolator"android:duration="2000"        >    </rotate></set>

























Android攻城獅四種基礎動畫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.