我有一个FrameLayout可以识别滑动手势(向上和向下).
例如:如果执行向上滑动,我应该为当前视图(即MATCH_PARENT x MATCH_PARENT)设置动画,以便在新视图来自底部的同时上升.
我可以通过动画实现这一目标吗?
解决方法:
我这样解决了:
private voID swipeUp() { current.currentPage++; final VIEw hIDingVIEw = currentVIEw; TranslateAnimation hIDe = new TranslateAnimation(0, 0, 0, -getHeight()); hIDe.setAnimationListener(new AnimationListenerAdapter() { @OverrIDe public voID onAnimationEnd(Animation animation) { hIDingVIEw.setVisibility(VIEw.GONE); } }); hIDe.setDuration(1000); hIDingVIEw.startAnimation(hIDe); TranslateAnimation show = new TranslateAnimation(0, 0, getHeight(), 0); show.setFillAfter(true); show.setDuration(1000); VIEw nextVIEw = getVIEw(); addVIEw(nextVIEw, createLP()); nextVIEw.startAnimation(show); currentVIEw = nextVIEw;}
总结 以上是内存溢出为你收集整理的android – 使用动画来滑动视图全部内容,希望文章能够帮你解决android – 使用动画来滑动视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)