javaandroidandroid-studioslidingpanelayout

Get slidingpanellayout events


I'm using sliding panels with my android app, but i need to get an event when the panel is up, is there a way listen to when it happens?

im using a sothree Sliding panel library


Solution

  • Looks like you are talking about umano/AndroidSlidingUpPanel. After briefly looking at the documentation/code you should be able to set a PanelSlideListener to your SlidingUpPanelLayout. They also provide a SimplePanelSlideListener which inserts no-ops for any functions you choose not to implement, which is probably what you will want to use.

    For example inside of your Activity's onCreate you could do something like:

    SlidingUpPanelLayout slidingPanel = (SlidingUpPanelLayout)findViewById(R.id.your_sliding_layout);
    slidingPanel.setPanelSlideListener(new SimplePanelSlideListener() {
        @Override
        public void onPanelExpanded(View panel) {
            // Insert your code here
        }
    });