SwipeView类似桌面的滑动界面(7)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-06 08:44 点击:次
}
/**
* Set the width of each page by using the layout parameters of a child. Call this function before you add
* the child to the SwipeView to maintain the child's size. This function returns an integer that should
* be added to the left margin of the first child and the right margin of the last child. This enables all
* the children to appear to be central
*
* @param childLayoutParams A child view that you have added / will add to the SwipeView
* @return An integer to add to the left margin of the first child and the right margin of the last child
*/
public int calculatePageSize(MarginLayoutParams childLayoutParams)
{
return setPageWidth(childLayoutParams.leftMargin + childLayoutParams.width + childLayoutParams.rightMargin);
}
/**
* Return the current width of each page
*
* @return Returns the width of each page
*/
public int getPageWidth()
{
return mPageWidth;
}
/**
* Assign a PageControl object to this SwipeView. Call after adding all the children
*
* @param pageControl The PageControl object to assign
*/
public void setPageControl(PageControl pageControl)
{
mPageControl = pageControl;
pageControl.setPageCount(getPageCount());
pageControl.setCurrentPage(mCurrentPage);
pageControl.setOnPageControlClickListener(new OnPageControlClickListener()
{
public void goForwards()
{
smoothScrollToPage(mCurrentPage+1);
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>