Created
December 3, 2015 12:13
-
-
Save brucetoo/3c4d440d944c63293c18 to your computer and use it in GitHub Desktop.
ViewPager嵌套ViewPager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.netease.cc.widget.pulltorefresh; | |
| import android.content.Context; | |
| import android.support.v4.view.ViewPager; | |
| import android.util.AttributeSet; | |
| import android.view.MotionEvent; | |
| /** | |
| * Created by Bruce too | |
| * On 2015/12/3 | |
| * At 18:37 | |
| * 解决ViewPager套ViewPager 外部viewPager不让其滑动 | |
| */ | |
| public class NoscrollViewPager extends ViewPager { | |
| public NoscrollViewPager(Context context) { | |
| super(context); | |
| } | |
| public NoscrollViewPager(Context context, AttributeSet attrs) { | |
| super(context, attrs); | |
| } | |
| @Override | |
| public boolean onInterceptTouchEvent(MotionEvent ev) { | |
| //父类viewpager的滑动事件会默认传递给子viewpager去做滑动处理 super.onInterceptTouchEvent(ev) | |
| return false; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment