最后一小节其实真的一行代码就行了,效果是一样的
@Override public void onPageScrolled(int pos, float posOffset, int posOffsetPex) { // TODO Auto-generated method stub Log.e("TAG", pos + "," + posOffset + "," + posOffsetPex); LinearLayout.LayoutParams lp = (android.widget.LinearLayout.LayoutParams) mTablineIv.getLayoutParams(); lp.leftMargin = (int) ((pos+posOffset) * mTablineLen); mTablineIv.setLayoutParams(lp); }