private void buildViewPager() { mViewPager = (ViewPager) findViewById(R.id.viewpager); TimeLinePagerAdapter adapter = new TimeLinePagerAdapter(getFragmentManager()); mViewPager.setOverScrollMode(View.OVER_SCROLL_NEVER); mViewPager.setOffscreenPageLimit(3); mViewPager.setAdapter(adapter); mViewPager.setOnPageChangeListener(onPageChangeListener); gestureDetector = new GestureDetector(BrowserWeiboMsgActivity.this, new MyOnGestureListener()); mViewPager.setOnTouchListener( new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return gestureDetector.onTouchEvent(event); } }); }
@Override public void setOverScrollMode(int mode) { if (mode != OVER_SCROLL_NEVER) { if (leftGlow == null) { Context context = getContext(); leftGlow = new EdgeEffect(context); rightGlow = new EdgeEffect(context); updateTint(); } } else { leftGlow = null; rightGlow = null; } try { super.setOverScrollMode(OVER_SCROLL_NEVER); } catch (Exception e) { // Froyo } this.overscrollMode = mode; }