亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

淺談Android動畫

難度中級
時長31分
學習人數
綜合評分9.60
146人評價 查看評價
9.8 內容實用
9.5 簡潔易懂
9.5 邏輯清晰
  • 逐幀動畫“FrameAnimation” 1. 在Drawable文件夾下定義animation-list.xml <animation-list xmlns:android="http://schemas.android.com/apk/res/android" > <!-- 按順序排列 drawable指定一張圖片 duration指定每張圖片停留的時間 --> <item android:drawable="@drawable/one" android:duration="500"/> <item android:drawable="@drawable/six" android:duration="500"/> <item android:drawable="@drawable/three" android:duration="500"/> <item android:drawable="@drawable/two" android:duration="500"/> </animation-list> 2.為ImageView設置資源 mImageView.setImageResource(R.drawable.anim_list); //設置圖片資源即可。
    查看全部
  • 布局動畫“舉例,listView使用LayoutAnimation” Animation animation=AnimationUtils.loadAnimation(this, R.anim.zoom_in); LayoutAnimationController controller=new LayoutAnimationController(animation); controller.setOrder(LayoutAnimationController.ORDER_NORMAL);//設置顯示順序,具體看源碼 listView.setLayoutAnimation(controller);//將控制器設置給listView listView.startLayoutAnimation();//開始布局動畫
    查看全部
  • 組合動畫四“Activity切換時的動畫” Intent intent=new Intent(MainActivity.this, SecondActivity.class); startActivity(intent); //注意:要在startActivity之后使用overridePendingTransition,否則無效 overridePendingTransition(R.anim.zoom_in, R.anim.zoom_out);//分別是進入時的動畫,和退出時的動畫
    查看全部
  • 組合動畫“使用設置重復,來進行動畫重復播放。” AlphaAnimation alphaAnimation=new AlphaAnimation(0.1f, 1f);//使用代碼動態增加動畫。 alphaAnimation.setDuration(1000); alphaAnimation.setRepeatCount(2); //設置重復次數 alphaAnimation.setRepeatMode(Animation.REVERSE); //reverse代表倒序重復,restart表示正序重復 mImageView.startAnimation(alphaAnimation); 其中,reverse和restart。 /** * When the animation reaches the end and the repeat count is INFINTE_REPEAT * or a positive value, the animation restarts from the beginning. */ public static final int RESTART = 1; /** * When the animation reaches the end and the repeat count is INFINTE_REPEAT * or a positive value, the animation plays backward (and then forward again). */ public static final int REVERSE = 2;
    查看全部
  • 組合動畫二“在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> <!-- *在一個文件中定義兩個動畫,則兩個動畫都會執行 *android:startOffset="1000" 動畫延遲執行的毫秒數。此時表示動畫在1s之后執行。配合上面的動畫實現動畫連續播放效果。 --> <alpha android:fromAlpha="1" android:toAlpha="0.1" android:startOffset="1000" android:duration="1000" > </alpha> </set>
    查看全部
  • 組合動畫一“使用動畫監聽器實現” animation=AnimationUtils.loadAnimation(this, R.anim.alpha); mImageView.startAnimation(animation); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { animation=AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate); mImageView.startAnimation(animation); } });
    查看全部
  • 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>
    查看全部
  • 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>
    查看全部
  • 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>
    查看全部
  • 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開始動畫,參數為設置好的動畫
    查看全部
  • 動畫-19
    查看全部
  • 動畫-18
    查看全部
  • 動畫-17
    查看全部
  • 動畫-16
    查看全部
  • 動畫-15
    查看全部

舉報

0/150
提交
取消
課程須知
本課程為基礎課程: 1.基本掌握Android基礎相關知識。 2.熟練掌握布局文件xml的使用 3.靈活應用xml中各個屬性的用途
老師告訴你能學到什么?
1.動畫效果概覽 2.四種基礎動畫實現 3.各種特效實例的實現

微信掃碼,參與3人拼團

微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復購買,感謝您對慕課網的支持!