私はアンドロイドの経験があまりないので、あるアクティビティと別のアクティビティの間でスクロールアニメーションを実装する方法を、おそらくいくつかのチュートリアルで理解したいと思います。あなたの助けを願っています
17674 次
1 に答える
25
You can set up animations (like slide) when you switch between activities like this :
In the res
folder, create an anim
folder
For example, put two xml
files for a slide effect :
slide_in.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200"/>
</set>
slide_out.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:fromXDelta="100%" android:toXDelta="0%"
android:fromYDelta="0%" android:toYDelta="0%"
android:duration="200" />
</set>
Then on your java code just write this :
Intent i = new Intent(YourActivity.this, OtherActivity.class);
this.startActivity(i);
overridePendingTransition(R.anim.slide_in, R.anim.slide_out);
If you are testing that on a real device, don't forget to allow it to play animations (Settings -> Display -> Animations -> All Animations)
Hope it helps ! :)
于 2012-08-23T13:41:07.487 に答える