android动画幻灯片下载

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了android动画幻灯片下载相关的知识,希望对你有一定的参考价值。

  1. public void setLayoutAnim_slidedown(ViewGroup panel, Context ctx) {
  2.  
  3. AnimationSet set = new AnimationSet(true);
  4.  
  5. Animation animation = new TranslateAnimation(
  6. Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
  7. 0.0f, Animation.RELATIVE_TO_SELF, -1.0f,
  8. Animation.RELATIVE_TO_SELF, 0.0f);
  9. animation.setDuration(800);
  10. animation.setAnimationListener(new AnimationListener() {
  11.  
  12. @Override
  13. public void onAnimationStart(Animation animation) {
  14. // TODO Auto-generated method stub
  15. // MapContacts.this.mapviewgroup.setVisibility(View.VISIBLE);
  16.  
  17. }
  18.  
  19. @Override
  20. public void onAnimationRepeat(Animation animation) {
  21. // TODO Auto-generated method stub
  22.  
  23. }
  24.  
  25. @Override
  26. public void onAnimationEnd(Animation animation) {
  27.  
  28. // TODO Auto-generated method stub
  29.  
  30. }
  31. });
  32. set.addAnimation(animation);
  33.  
  34. LayoutAnimationController controller = new LayoutAnimationController(
  35. set, 0.25f);
  36. panel.setLayoutAnimation(controller);
  37.  
  38. }
  39.  
  40. public void setLayoutAnim_slideup(ViewGroup panel, Context ctx) {
  41.  
  42. AnimationSet set = new AnimationSet(true);
  43.  
  44. /*
  45. * Animation animation = new AlphaAnimation(1.0f, 0.0f);
  46. * animation.setDuration(200); set.addAnimation(animation);
  47. */
  48.  
  49. Animation animation = new TranslateAnimation(
  50. Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
  51. 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
  52. Animation.RELATIVE_TO_SELF, -1.0f);
  53. animation.setDuration(800);
  54. animation.setAnimationListener(new AnimationListener() {
  55.  
  56. @Override
  57. public void onAnimationStart(Animation animation) {
  58. // TODO Auto-generated method stub
  59.  
  60. }
  61.  
  62. @Override
  63. public void onAnimationRepeat(Animation animation) {
  64. // TODO Auto-generated method stub
  65.  
  66. }
  67.  
  68. @Override
  69. public void onAnimationEnd(Animation animation) {
  70. // MapContacts.this.mapviewgroup.setVisibility(View.INVISIBLE);
  71. // TODO Auto-generated method stub
  72.  
  73. }
  74. });
  75. set.addAnimation(animation);
  76.  
  77. LayoutAnimationController controller = new LayoutAnimationController(
  78. set, 0.25f);
  79. panel.setLayoutAnimation(controller);
  80.  
  81. }

以上是关于android动画幻灯片下载的主要内容,如果未能解决你的问题,请参考以下文章

Android 从左到右滑动动画

我可以更改 Android startActivity() 过渡动画吗?

未调用 Android MotionLayout 过渡侦听器

Android中实现一个简单的逐帧动画(附代码下载)

将 Android 图库用作自动幻灯片

Android的动画效果类似翻书效果