解决方案 »

  1.   

    如果有100页 不建议用ViewPager,建议自定义组件去处理,
    因为翻页的时候很多页面是不需要初始化的,等到需要显示的时候再去处理,这样内存占用小很多。
    比如预先加载4,5个页面即可,另外是 本地有图片的话 很多内存需要及时回收。
      

  2.   


        /**
         * Set the currently selected page. If the ViewPager has already been through its first
         * layout with its current adapter there will be a smooth animated transition between
         * the current item and the specified item.
         *
         * @param item Item index to select
         */
        public void setCurrentItem(int item) {
            mPopulatePending = false;
            setCurrentItemInternal(item, !mFirstLayout, false);
        }    /**
         * Set the currently selected page.
         *
         * @param item Item index to select
         * @param smoothScroll True to smoothly scroll to the new item, false to transition immediately
         */
        public void setCurrentItem(int item, boolean smoothScroll) {
            mPopulatePending = false;
            setCurrentItemInternal(item, smoothScroll, false);
        }
    请看这个代码说明
    调用第二个方法(不要滑动)。直接跳到某一项。
    如果是第一个方法, 它会一个一个划过去的 。
      

  3.   

    谢谢,问题已经解决了,设定一下加载的页面数限制,主要是每页显示的图片太大了,3、4M,压缩一下图片速度就OK了