0

当我从 ViewPager 打印当前位置时,这令人困惑。我搜索了它并从stackoverflow获得了解决方案。但我想知道当页面发生变化时,是否有可能从 viewpager 连续获取确切的布局位置。实际上我想在 instanceItem 方法中获取当前位置。可能吗。这是我的代码:

@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;
    } 
4

1 回答 1

0

尝试 pageView.getCurrentItem();

于 2013-05-10T13:33:31.987 回答