Use Xml-based animation Create an Xml file in the res / anim / animate.xml folder
Enter a code
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="true"> <translate android:fromXDelta="0%p" android:toXDelta="50%p" // change this to decide the range android:duration="500" android:startOffset="0"/> <translate android:fromXDelta="0%p" android:toXDelta="100%p" android:duration="500" android:startOffset="500"/>// change this to increase the time for image to stay </set>
now in your myslideshow () function change
Animation inFromRight = AnimationUtils.loadAnimation(this, R.anim.animate); gallery.startAnimation(inFromRight); gallery.setSelection(PicPosition);
That's all.....
source share