私は、シネマの席を並べています。私はある種のズームを行うためにアニメーションのセット(スケールと翻訳)を適用する必要があります。私はすべてのビューにアニメーションを適用します。アニメーションは、次のようになります。私はID scrollable_places
でRelativeLayout
に私の意見を入れてアニメーションの終了後にスクロールします。android
<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!"/>
:
だから、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;
、私のレイアウトは次のようになります。アニメーションの終了後、このビューの一部は画面外に出ますが、スクロールは使用できません。 dimentions
をRelativeLayout or other, parent, layouts
に再定義する必要があると思いますが、手動で行う方法はわかりません。 ありがとう!
ありがとう!それはScrollViewでうまく動作しますが、HorizontalScrollView(レイアウトで親としてScrollViewを持つ)で同じトリックを実行したい場合は、View.FOCUS_DOWNをView.FOCUS_RIGHTに置き換えただけです。これは動作しません。私のレイアウトに何か間違いがありますか? – arbuzz
また、あなたのレイアウトに関する質問もここにあります。このスレッドは、水平および垂直のスクロールに関するものです。 http://stackoverflow.com/questions/2044775/scrollview-vertical-and-horizontal-in-android – Snicolas
ありがとう、それは助けた! – arbuzz