1
我使用HorizontalScollView實現了圓形自動水平滾動。創建圓形自動水平滾動視圖?
我所做的:我說孩子的線性佈局,包含初始默認子視圖讓我們說10
private void startScrolling() {
handler.postDelayed(new Runnable() {
public void run() {
counter = (int) (counter + 10);
handler.postDelayed(this, 100);
viewCount++;
if(viewCount == MAX_CHILD) {
viewCount = 0;
resetViewPosition(0);
}
mScroller.scrollTo(counter , 0);
}
}, 1000L);
}
現在,一旦滾動開始刪除它首先索引視圖,並在最後的加同一個元素視圖。由於定時器使用postDelay()實現,視圖繼續滾動。
private void resetViewPosition(int viewIndex) {
View view = llParent.getChildAt(viewIndex);
Log.v(TAG, "resetViewPosition : "+view.getId()+", "+llParent.getChildCount());
llParent.removeViewAt(viewIndex);
llParent.addView(view);
}
問題:滾動型停止滾動初始元素lenth後滾動,即它不是線性佈局,增加新的孩子擴大。
請建議我在這裏可以做什麼來實現它。
根據我們的聊天討論,並進行日誌記錄:https://code.google.com/p/infinite-gallery/ – g00dy
試試這個: http://stackoverflow.com/questions/4720469/horizontalscrollview-auto-scroll-to-end-when-new-views-are-added –
謝謝..將試試..因爲問題很久以前問過所以不知道我需要它:) – CoDe