PagerSlidingTabStrip
PagerSlidingTabStrip copied to clipboard
How can I disable the tabs?
I was trying to disable the tabs, using the setEnable(false), but it doesn't work. Is there a way to disable the tabs? I'm doing an animation and I need to disable the tabs while the animation is been executed. After that, I have to enable the tabs again.
You have to modify the PagerSlidingTabStrip class.
An alternative solution would be to extend the PagerSlidingTabStrip
class and override the onInterceptTouchEvent()
method to return true in case a flag is set, something like this:
public class CustomTabStrip extends PagerSlidingTabStrip {
private boolean disabled;
public CustomTabStrip(Context context) {
super(context);
}
public CustomTabStrip(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomTabStrip(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return disabled || super.onInterceptTouchEvent(ev);
}
}
Thank you
On Thu, Aug 21, 2014 at 5:46 AM, Tom Reznik [email protected] wrote:
An alternative solution would be to extend the PagerSlidingTabStrip class and override the onInterceptTouchEvent() method to return true in case a flag is set, something like this:
public class CustomTabStrip extends PagerSlidingTabStrip { private boolean disabled;
public CustomTabStrip(Context context) { super(context); } public CustomTabStrip(Context context, AttributeSet attrs) { super(context, attrs); } public CustomTabStrip(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setDisabled(boolean disabled) { this.disabled = disabled; } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return disabled || super.onInterceptTouchEvent(ev); }}
— Reply to this email directly or view it on GitHub https://github.com/astuetz/PagerSlidingTabStrip/issues/94#issuecomment-52849299 .
It works for me