1--->0时会出现一个问题,那个指示器 会从3再跳一次1或者从2再跳一次。我表达的不清楚,你可以放到你的手机上滑动试试。视频很好,学知识啦
2014-11-18
if (mCurrentPageIndex > position){
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + (positionOffset - 1) * mScreen1_3);
}
else
{
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + positionOffset * mScreen1_3);
}
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + (positionOffset - 1) * mScreen1_3);
}
else
{
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + positionOffset * mScreen1_3);
}
2014-11-17
老师您好,看了您的代码,完全可以更简明一点
//或
if (mCurrentPageIndex - position > 0){
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + (positionOffset - 1) * mScreen1_3);
}
else
{
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + positionOffset * mScreen1_3);
}
//当然也可以判断等于1或者等于0,不过对于您这个列子,上面的代码完全达到要求
//或
if (mCurrentPageIndex - position > 0){
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + (positionOffset - 1) * mScreen1_3);
}
else
{
lp.leftMargin = (int)(mCurrentPageIndex * mScreen1_3 + positionOffset * mScreen1_3);
}
//当然也可以判断等于1或者等于0,不过对于您这个列子,上面的代码完全达到要求
2014-11-17