1

I want to change the visblity of an item when AndroidSlidingUpPanel is expanded to full screen.Is there any listener which detects whether sliding panel is full screen?I tried using this but didn't worked-

slidingPaneLayout.setOnDragListener(new View.OnDragListener() {
            @Override
            public boolean onDrag(View v, DragEvent event) {
                if(slidingPaneLayout.getPanelHeight()>700)
                belowarrow.setVisibility(View.GONE);
                return true;
            }
        });
Android Developer
  • 9,157
  • 18
  • 82
  • 139

1 Answers1

4
 slidingPaneLayout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
            @Override
            public void onPanelSlide(View view, float v) {

            }

            @Override
            public void onPanelCollapsed(View view) {

              //here collapse
            }

            @Override
            public void onPanelExpanded(View view) {
                //here it is in fullscreen
            }

            @Override
            public void onPanelAnchored(View view) {

            }

            @Override
            public void onPanelHidden(View view) {

            }
        });

Here you go and i hope it will help

murielK
  • 1,000
  • 1
  • 10
  • 21
  • 1
    Small tip: if you're not interested in all the callbacks, simply implement `SlidingUpPanelLayout.SimplePanelSlideListener` and only override the relevant bits and pieces. – MH. Apr 08 '15 at 13:02
  • if i want to hide an image when panel is fully expanded to full screen(maximun height) then i need to hide it inside onPanelExpanded()? – Android Developer Apr 08 '15 at 13:02
  • @murieldotCMR: What rest? The `SimplePanelSlideListener` provided by the library is exactly for those scenarios where you're only interested in one or two callbacks. As such, you only override the one(s) you're interested in; the others will remain an empty no-op. It's not required to do so, obviously, but it'll be faster to implement and reduces code clutter. – MH. Apr 08 '15 at 13:09
  • @MH. again you still will have to override the rest of method there is a difference between empty no-op and override method. – murielK Apr 08 '15 at 13:11
  • @murieldotCMR: I think you're misunderstanding my point. What I'm trying to say is that in stead of implementing the full listener interface, you can also opt to override the ['simple' implementation](https://github.com/umano/AndroidSlidingUpPanel/blob/master/library/src/com/sothree/slidinguppanel/SlidingUpPanelLayout.java#L249). It's less work and keeps your code cleaner. Functionally, there is zero difference, visually, there is. I.e. compare [this](https://gist.github.com/mhelder/f776772f9095f2bba86a) to your answer. Hopefully that'll clear things up. – MH. Apr 08 '15 at 13:18
  • 5
    Worth noting that for some reason, version 3.3.0 of this library omits the method "setPanelSlideListener". Downgrading to 3.2.1 resolved it for me. – Elad Nava Sep 08 '16 at 15:21
  • This is not work anymore, now you can only override onPanelSlide and onPanelStateChanged. – Denny Kurniawan Mar 06 '19 at 14:14
  • 2
    @EladNava if I understand it correctly, the simply change the name to `addPanelSlideListener()` – Ilya Maier Aug 08 '20 at 21:28