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