android开发

您所在的位置:网站首页 线上科学实验网课 android开发

android开发

#android开发| 来源: 网络整理| 查看: 265

android开发 - tween动画 原创

Johnny_Cheung 2023-05-03 02:31:30 博主文章分类:android ©著作权

文章标签 android xml Java 文章分类 Python 后端开发

©著作权归作者所有:来自51CTO博客作者Johnny_Cheung的原创作品,请联系作者获取转载授权,否则将追究法律责任

android提供了两种动画

tween动画     通过对view的内容进行一系列的图形变换,有平移,缩放,旋转,改变透明度,来实现      操作过程 1. 在res下新建一个anim文件夹,然后在anim里添加一个alpha.xml文件

   如这样:  添加一个渐变到无的效果

Java代码

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.alpha); ImageView imageView = (ImageView)this.findViewById(R.id.imageview); imageView.startAnimation(animation);

平移

Java代码    

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.translate); animation.setFillAfter(true); ImageView imageView = (ImageView)this.findViewById(R.id.imageview); imageView.startAnimation(animation);

缩放或者扩大

Java代码

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.scale); animation.setFillAfter(true); ImageView imageView = (ImageView)this.findViewById(R.id.imageview); imageView.startAnimation(animation);

旋转

Java代码  

Animation animation = AnimationUtils.loadAnimation(MainActivity.this, R.anim.rotate); animation.setFillAfter(true); ImageView imageView = (ImageView)this.findViewById(R.id.imageview); imageView.startAnimation(animation);

frame动画

收藏 评论 分享 举报

上一篇:activity生命周期

下一篇:android开发 - ViewPager使用



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3