1
我想要移动到具有动画的画廊中的特定位置。例如,我在一个像册100种元素和实际位置是0。我想移动缓慢(动画)来定位99.如何动画到一个画廊的特定位置
我尝试了下面的命令,这似乎有希望的。不过,这并不动画:-(
gallery.setSelection(int position, boolean animate)
任何提示
我想要移动到具有动画的画廊中的特定位置。例如,我在一个像册100种元素和实际位置是0。我想移动缓慢(动画)来定位99.如何动画到一个画廊的特定位置
我尝试了下面的命令,这似乎有希望的。不过,这并不动画:-(
gallery.setSelection(int position, boolean animate)
任何提示
也许你不得不使用这样的事情: 创建animate.xml文件
<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"/>
并在代码中使用这个:
Animation inFromRight = AnimationUtils.loadAnimation(this, R.anim.animate);
gallery.startAnimation(inFromRight);
gallery.setSelection(PicPosition);
想法是从这个链接:
谢谢。我可以通过编程来完成吗? (没有静态的xml定义)0-99只是一个例子。 我想动态地跳到任何位置。 5-60,90-10等... –