public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
System.out.println("position:"+position+",positionOffset:"+positionOffset+",positionOffsetPixels:"+positionOffsetPixels);
LinearLayout.LayoutParams lp = (LayoutParams) iv_tabLine.getLayoutParams();
/*if(currerPagerIndex == 0 && position == 0 ){ // 0->1
lp.leftMargin = (int) (sCreen1_3 * positionOffset + currerPagerIndex * sCreen1_3);
}else if(currerPagerIndex == 1 && position == 0 ){ //1->0
lp.leftMargin = (int) (currerPagerIndex * sCreen1_3 + sCreen1_3 * (1-positionOffset));
}else if(currerPagerIndex == 1 && position == 1){ //1->2
lp.leftMargin = (int) (currerPagerIndex * sCreen1_3 + sCreen1_3 * positionOffset);
}else if(currerPagerIndex == 2 && position == 1){ //2->1
lp.leftMargin = (int) (currerPagerIndex * sCreen1_3 + sCreen1_3 * (1-positionOffset));
}*/
lp.leftMargin = (int) (sCreen1_3 * position + sCreen1_3 * positionOffset);
iv_tabLine.setLayoutParams(lp);
}
老师,可以这样写吗?运行结果一样,不知这样常不常用。