0
當我從ViewPager打印當前位置時會感到困惑。我搜索它並從stackoverflow獲得解決方案。但是我想知道是否有可能在頁面更改時從viewpager連續獲取確切的佈局位置。其實我想獲得instantiateItem方法中的當前位置。可能嗎。這裏是我的代碼:如何從viewpager獲取精確的頁面位置?
@Override
public Object instantiateItem(ViewGroup container, int position) {
// using the position parameter, inflate the proper layout, also add
// it to the container parameter
ViewGroup pageView = (ViewGroup) mInflater.inflate(
mLayouts[position], container, false);
container.addView(pageView);
return pageView;
}