SwipeView类似桌面的滑动界面(5)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
/**
* Set the swiping threshold distance to make the screens change
*
* @param swipeThreshold The minimum distance the finger should move to allow the screens to change
*/
public void setSwipeThreshold(int swipeThreshold)
{
DEFAULT_SWIPE_THRESHOLD = swipeThreshold;
}
/**
* Get the current page the SwipeView is on
*
* @return The current page the SwipeView is on
*/
public int getCurrentPage()
{
return mCurrentPage;
}
/**
* Return the number of pages in this SwipeView
*
* @return Returns the number of pages in this SwipeView
*/
public int getPageCount()
{
return mLinearLayout.getChildCount();
}
/**
* Go directly to the specified page
*
* @param page The page to scroll to
*/
public void scrollToPage(int page)
{
scrollToPage(page,false);
}
/**
* Animate a scroll to the specified page
*
* @param page The page to animate to
*/
public void smoothScrollToPage(int page)
{
scrollToPage(page,true);
}
private void scrollToPage(int page, boolean smooth)
{
int oldPage = mCurrentPage;
if(page>=getPageCount() && getPageCount()>0)
{
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>