All about com.sothree.slidinguppanel.SlidingUpPanelLayout

When I used SlidingUpPanelLayout, I need to install two children's layouts (main and panel). When the second layout (panel) opens, I want to close it using Button. But I did not find the method.

What is a method?

+4
source share
2 answers

LAST VERSION IN THE BOTTOM

If I understand you well, do you want to implement listenerwhen the second viewopens correctly?

The way to do this would be as follows:

first declare SlidingUpPanelLayout:

SlidingUpPanelLayout layout;

then initialize it to onCreate()

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

After that, if you want, you can set its children clickable:

layout.setEnableDragViewTouchEvents(true);  

. layout

 layout.setPanelSlideListener(new PanelSlideListener() {

        @Override
        public void onPanelSlide(View panel, float slideOffset) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onPanelCollapsed(View panel) {
            // TODO Auto-generated method stub
            //Anything you put here is going to happen if the view is closed
        }

        @Override
        public void onPanelExpanded(View panel) {
            // TODO Auto-generated method stub
            //Anything you put here is going to happen if the view is open
        }

        @Override
        public void onPanelAnchored(View panel) {
            // TODO Auto-generated method stub

        }
    });

, ! !

EDIT: / , boolean:

layout.collapsePane(true); //to close
layout.expandPane(true); //to open

.

layout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED); //to close
layout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED); //to open
+12

com.sothree.slidinguppanel: library

  • SlidingUpPanelLayout

    SlidingUpPanelLayout mSlideUpPanel;

  • :

    mSlideUpPanel = (SlidingUpPanelLayout) findViewById (R.id.slidingUpPanel);

  • :

    mSlideUpPanel.addPanelSlideListener( SlidingUpPanelLayout.PanelSlideListener() {           @Override           public void onPanelSlide ( , float slideOffset) {

            }
    
            @Override
            public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
    
            }
        });
    
+1

Source: https://habr.com/ru/post/1534757/


All Articles