水平和垂直ViewPager

时间:2013-10-31 06:54:03

标签: android android-viewpager



是否有人成功实施了水平和垂直滚动的ViewPager?

我知道Directional ViewPager,当我使用它时它会给出

<i>31 12:11:29.954: E/AndroidRuntime(14670): java.lang.NoClassDefFoundError: com.directionalviewpager.DirectionalViewPager$DataSetObserver
10-31 12:11:29.954: E/AndroidRuntime(14670):    at com.directionalviewpager.DirectionalViewPager.setAdapter(DirectionalViewPager.java:164)</i>

第164行: mObserver = new DataSetObserver();

public void setAdapter(PagerAdapter adapter) {
    if (mAdapter != null) {
        VerticalViewPagerCompat.setDataSetObserver(mAdapter, null);
    }

    mAdapter = adapter;

    if (mAdapter != null) {
        if (mObserver == null) {
            mObserver = new DataSetObserver();
        }
        VerticalViewPagerCompat.setDataSetObserver(mAdapter, mObserver);
        mPopulatePending = false;
        if (mRestoredCurItem >= 0) {
            mAdapter.restoreState(mRestoredAdapterState, mRestoredClassLoader);
            setCurrentItemInternal(mRestoredCurItem, false, true);
            mRestoredCurItem = -1;
            mRestoredAdapterState = null;
            mRestoredClassLoader = null;
        } else {
            populate();
        }
    }
}

谢谢,

1 个答案:

答案 0 :(得分:0)

我找到了答案您只需将DirectionalViewPager作为库添加到项目中

Add this image as an external library

此图片位于 Android-DirectionalViewPager-master \ Android-DirectionalViewPager-master \ library \ bin

并且你不要忘记从订单和导出标签中包含它