3
我有一个视图阵列,在电影院的座位。我需要对它们应用一组动画(缩放和平移)来进行某种缩放。我将动画应用于每个视图。动画看起来是这样的:动画结束后滚动,android
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!"/>
我把我的意见纳入RelativeLayout
id为scrollable_places
。所以,在动画结束后,这些视图中的一些超出了屏幕的范围,但没有可用的滚动条。 我想我需要重新定义dimentions
RelativeLayout or other, parent, layouts
,但我不知道如何手动。 谢谢!
thanks!它适用于ScrollView,但如果我想用HorizontalScrollView(在我的布局中具有ScrollView作为父级)执行相同的技巧,则只需将View.FOCUS_DOWN替换为View.FOCUS_RIGHT,但这不起作用。可能是我的布局有问题? – arbuzz
你也应该看看你的布局问题。这个线程是关于水平和垂直滚动的。 http://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android – Snicolas
非常感谢,它帮助! – arbuzz