translateanimationandroid动画,translateanimation,是否可以实现让两个控件流畅的执行同一动画?

translateanimation  时间:2021-06-17  阅读:()

Android ImageView启动TranslateAnimation之后,如何得到移动过程中的位置。

展开全部   采用Animation.AnimationListener,在onAnimationEnd的方法中改变当前视图利用LayoutParams的setMargins方法重新定位位置。

  代码:   public void move() {   jqkjScroll.setEnabled(true);   Animation mTranslateAnimation = new TranslateAnimation(0, 0, 0,   -showheight);// 移动   mTranslateAnimation.setDuration(minute);   // mAnimationSet.setFillAfter(true);   // mTranslateAnimation.setFillAfter(true);   mTranslateAnimation   .setAnimationListener(new Animation.AnimationListener() {   public void onAnimationStart(Animation animation) {   if (isNoMenu == false) {   curent.setVisibility(View.GONE);   }   }   public void onAnimationEnd(Animation animation) {   RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(   contentLayout.getLayoutParams());   contentImg.setImageResource(R.drawable.open);   params.setMargins(0, endY - startY, 0, 0);   contentLayout.clearAnimation();   contentLayout.setLayoutParams(params);   jqkjScroll.scrollTo(0, 0);   isMoveORShowing = false;   }   public void onAnimationRepeat(Animation animation) {   }   });   contentLayout.startAnimation(mTranslateAnimation);   }   public void show() {   jqkjScroll.setEnabled(false);   Animation mTranslateAnimation = new TranslateAnimation(0, 0, 0,   showheight);// 移动   mTranslateAnimation.setDuration(minute);   mTranslateAnimation   .setAnimationListener(new Animation.AnimationListener() {   public void onAnimationStart(Animation animation) {   if (isNoMenu == false) {   curent.setVisibility(View.VISIBLE);   }   }   public void onAnimationEnd(Animation animation) {   contentImg.setImageResource(R.drawable.close);   isMoveORShowing = false;   contentLayout.clearAnimation();   RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(   contentLayout.getLayoutParams());   params.setMargins(0, showheight + endY - startY, 0, 0);   contentLayout.setLayoutParams(params);   }   public void onAnimationRepeat(Animation animation) {   }   });   contentLayout.startAnimation(mTranslateAnimation);   }

android studio 怎么建立translate动画

Translate动画 定义一个开始的位置和一个结束位置,定义移动时间,自动产生移动动画。

Android的translate移动方向有横向(X)竖向(Y),?左右滑动使用了横向移动效果。

向上退出 out_to_up.xml (从屏幕上面退出) in_from_down.xml (从屏幕下面进入)

android两个animation无限循环怎么做?

据我所知,想直接给AnimationSet设置重复,是不行的。

不过你可以这样来: final int transDuration = 2000; final int alphaDuration = 1000; AnimationSet set = new AnimationSet(false); set.setRepeatMode(Animation.RESTART); TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, 300); translateAnimation.setInterpolator(new Interpolator() { @Override public float getInterpolation(float arg0) { float ret = arg0 / (1.0f * transDuration / (transDuration + alphaDuration)); return ret < 1 ? ret : 1; } }); translateAnimation.setRepeatCount(Animation.INFINITE); translateAnimation.setDuration(transDuration + alphaDuration); AlphaAnimation alphaAnimation = new AlphaAnimation(1, 0); alphaAnimation.setRepeatCount(Animation.INFINITE); alphaAnimation.setDuration(alphaDuration); alphaAnimation.setStartOffset(transDuration); set.addAnimation(translateAnimation); set.addAnimation(alphaAnimation); view.startAnimation(set); 或者像其他所说的,通过在一个动画结束后开始另外一个动画的方式。

android动画,translateanimation,是否可以实现让两个控件流畅的执行同一动画?

是的,你可以使用动画的情况下,一个单独的写了一个内部??方法,再加上视图参数控制传入的使用线程同步播放的。

当然,楼上的说是也。

不过是一个全球性的影响,不是每一个组件的影响。

牦牛云(3.5USD/月 )阿里云国际版云服务器 1核1G40G

收到好多消息,让我聊一下阿里云国际版本,作为一个阿里云死忠粉,之前用的服务器都是阿里云国内版的VPS主机,对于现在火热的阿里云国际版,这段时间了解了下,觉得还是有很多部分可以聊的,毕竟,实名制的服务器规则导致国际版无需实名这一特点被无限放大。以前也写过几篇综合性的阿里云国际版vps的分析,其中有一点得到很多人的认同,那句是阿里云不管国内版还是国际版的IO读写速度实在不敢恭维,相对意义上的,如果在这...

香港 1核1G 29元/月 美国1核 2G 36元/月 快云科技

快云科技: 11.11钜惠 美国云机2H5G年付148仅有40台,云服务器全场7折,香港云服务器年付388仅不到五折 公司介绍:快云科技是成立于2020年的新进主机商,持有IDC/ICP/ISP等证件资质齐全主营产品有:香港弹性云服务器,美国vps和日本vps,香港物理机,国内高防物理机以及美国日本高防物理机官网地址:www.345idc.com活动截止日期为2021年11月13日此次促销活动提供...

乐凝网络支持24小时无理由退款,香港HKBN/美国CERA云服务器,低至9.88元/月起

乐凝网络怎么样?乐凝网络是一家新兴的云服务器商家,目前主要提供香港CN2 GIA、美国CUVIP、美国CERA、日本东京CN2等云服务器及云挂机宝等服务。乐凝网络提供比同行更多的售后服务,让您在使用过程中更加省心,使用零云服务器,可免费享受超过50项运维服务,1分钟内极速响应,平均20分钟内解决运维问题,助您无忧上云。目前,香港HKBN/美国cera云服务器,低至9.88元/月起,支持24小时无理...

translateanimation为你推荐
离线包离线地图,离线导航包有什么区别机房360电脑上的杀毒软件被360覆盖了,怎么找回?prisma安卓版kovo安卓版的哪有下载?avc是什么格式格式工厂转的[AS3 720 AVC]mp4是什么格式国家法规数据库食品及食用农产品标准法规信息支撑和综合应用平台/食品安全标准与技术法规动态比对数据库如何查询标准comexceptionapro exception是什么意思网站客服代码在线客服系统的代码添加到网站中,要怎么做?特斯拉model3降价特斯拉官网为何会被挤崩?东兴证券网站东兴证券开户是假的吗?空间导航怎么把空间的导航变成只有留言板跟相册
主机租用 fdcservers cloudstack 大容量存储 宏讯 服务器防火墙 万网主机 后门 shuangcheng webmin so域名 weblogic部署 vi命令 极域网 qq部落24-5 主机响 中国最年轻博士 我的世界免费服务器 1500元电脑主机配置 灵动鬼影实录2 更多