2011-08-23 30 views
0

我需要为我的android应用程序构建类似于流的东西(如脉冲) 我尝试了几个horizo​​ntalListview或Horizo​​ntalScrollView,但它并不流畅!Android Gallery全宽,没有间隙

我找到的更流畅的小部件就是画廊。

我成功地调整了其右对齐:

http://cl.ly/0a3Q002u3H1f3w2l0g2e

我的问题是,当你滚动最大的权利。它看起来像流#3。 有没有办法改变这一点,以避免在右边的差距?

也许要改变最大可选位置(元素# - 4在我的情况)

谢谢。

回答

0

你可以尝试像

public class GalleryChild extends Gallery { 

... 

@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { 
    if (getSelectedItemPosition() >= getChildCount() - BUFFER) { 
     setSelection(getChildCount() - BUFFER, true); 
     /** Eat the event. */ 
     return true; 
    } else return super.onScroll(e1, e2, distanceX, distanceY); 
}