禁用SlidingUpPanelLayout中的滑动

时间:2016-06-12 13:34:29

标签: android slidingpanelayout

这是我的SlidingPanelLayout

 mLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);

 mLayout.addPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {


        @Override
        public void onPanelSlide(View panel,final float slideOffset) {
            Log.d(TAG, "onPanelSlide, offset " + slideOffset);






        }

        @Override
        public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
            Log.i(TAG, "onPanelStateChanged " + newState);
        }
    });

如何禁用滑动,我发现解决方案说使用此

@Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        return false;
    }

但我倾向于延长SlidingPaneLayout请不要让这个问题重复它不同我怎么能禁用我的代码刷卡不要告诉我扩展它我想这样工作任何想法ot和何时我吐了SlidingPaneLayout这段代码

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    return false;
}

@Override
public boolean onTouchEvent(MotionEvent ev) {
    return false;
}

无法显示其显示错误,因此如何禁用不带扩展的滑动

1 个答案:

答案 0 :(得分:1)

根据 SlidingUpPanelLayout

只需使用

mLayout.setEnabled(false);

多数民众赞成:)