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等... –