Java-动画结束后滚动,Android
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Java-动画结束后滚动,Android,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2193字,纯文字阅读大概需要4分钟。
内容图文
![Java-动画结束后滚动,Android](/upload/InfoBanner/zyjiaocheng/653/dd933f46e9e6442e89eccbe355f03954.jpg)
我有各种各样的看法,在电影院里坐着.我需要对它们应用一组动画(缩放和平移)以进行某种缩放.我将动画应用于每个视图.动画看起来像这样:
AnimationSet set = new AnimationSet(context, null);
float toXDelta = (place.getX() * 2) - place.getX();
float toYDelta = (place.getY() * 2) - place.getY();
Animation translate = new TranslateAnimation(0, toXDelta, 0, toYDelta);
translate.setDuration(4000);
translate.setFillAfter(true);
translate.setFillEnabled(true);
Animation scale = new ScaleAnimation(1, 5, 1, 5);
scale.setDuration(4000);
scale.setFillAfter(true);
scale.setFillEnabled(true);
set.addAnimation(translate);
set.addAnimation(scale);
set.setFillAfter(true);
set.setAnimationListener(new KaroAnimationListener(this));
animation = set;
因此,我的布局如下所示:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_width="fill_parent"
android:padding="10px">
<ScrollView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0"
android:id="@+id/vertical_scroll"
android:fillViewport="true">
<HorizontalScrollView
android:layout_height="fill_parent"
android:fillViewport="true"
android:id="@+id/scroll_view"
android:layout_width="wrap_content">
<RelativeLayout android:id="@+id/scrollable_places"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
</RelativeLayout>
</HorizontalScrollView>
</ScrollView>
<Button android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/reserve_places_button"
android:onClick="onReserveClick"
android:layout_below="@id/vertical_scroll"
android:layout_weight="1"
android:text="Bron!"/>
我将视图放入id为scrollable_places的RelativeLayout中.因此,动画结束后,某些视图将超出屏幕范围,但没有滚动可用.
我想我需要重新定义RelativeLayout或其他父级布局的尺寸,但是我不知道如何手动进行.
谢谢!
解决方法:
您可以尝试将滚动延迟发布到ScrollView的此端,如下所示:
scrollView.postDelayed( new Runnable() {
@Override
public void run() {
scrollView.fullScroll( View.FOCUS_DOWN);
}
}, 4300);
因此它适合在动画结束后开始播放,或者您可以在听动画结束后使用AnimationListener进行播放,在这种情况下,您可以使用比4300毫秒小的延迟,大约300毫秒可以完成.
问候,
斯特凡
内容总结
以上是互联网集市为您收集整理的Java-动画结束后滚动,Android全部内容,希望文章能够帮你解决Java-动画结束后滚动,Android所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。