切換時指示器跟隨滾動
咱老師想復雜啦,下面是我的測試代碼:
public void onPageScrolled(int position, float positionOffSet, int positionOffSetPx) {
? ? ? ? ? ? ? ? int marginLeft = (int) (position * separateWidth + positionOffSet * separateWidth);
? ? ? ? ? ? ? ? Log.i(tag,"margin left: " + marginLeft);
? ? ? ? ? ? ? ? LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) iv_separate.getLayoutParams();
? ? ? ? ? ? ? ? layoutParams.leftMargin = marginLeft;
? ? ? ? ? ? ? ? iv_separate.setLayoutParams(layoutParams);
? ? ? ? ? ? }
2014-11-06
你好,恭喜你,很多同學都歸納出來了,加油。
2015-01-04
后半截看著看著就睡著了。。??吹竭@句代碼啊一下就醒了 ? 啊哈 ? ? ??