2015-11-09 2 views

ответ

1

Вы можете просто установить OnClickListener равным null, например.

view.setOnClickListener(null); 
+0

спасибо, я попробую – David

0

хорошо здесь мое решение:

1.) нужны пользовательские pagerstrip:

CustomPagerTabStrip pagerTabStrip; 

класс CustomPagerTabStrip:

public class CustomPagerTabStrip extends PagerTabStrip { 

    private boolean isTabSwitchEnabled; 

    public CustomPagerTabStrip(Context context) { 
     super(context); 
    } 

    public CustomPagerTabStrip(Context context, AttributeSet attrs) { 
     super(context, attrs); 
     this.isTabSwitchEnabled = true; 
    } 

    @Override 
    public boolean onInterceptTouchEvent(MotionEvent event) { 
     System.out.println("ENable?? " + isTabSwitchEnabled); 
     if (this.isTabSwitchEnabled) { 
      return super.onInterceptTouchEvent(event); 
     } else { 
      return true; 
     } 
    } 

    @Override 
    public boolean onTouchEvent(MotionEvent event) { 
     if (this.isTabSwitchEnabled) { 
      return super.onTouchEvent(event); 
     } 
     return false; 
    } 

    public void setTabSwitchEnabled(boolean isSwipeEnabled) { 
     this.isTabSwitchEnabled = isSwipeEnabled; 
    } 
    } 

, чем вы можете легко включить или отключить его:

pagerTabStrip.setTabSwitchEnabled(true);