android-sliding-layer-lib icon indicating copy to clipboard operation
android-sliding-layer-lib copied to clipboard

It's hardly to open the slidinglayer if I place a listview on it

Open ideazxy opened this issue 11 years ago • 6 comments

I guess the listview consumes the necessary event, but I can't find a way to make it work just like the slidinglayer is empty. Do you have any suggest?

ideazxy avatar Aug 01 '13 17:08 ideazxy

I'm trying to, and the listview got some issue to handle click event

marshallino16 avatar Jan 23 '14 22:01 marshallino16

I put a Textview next to the ListView within my sliding layer to act as a "handle". That works fine. My only problem is, that a fling on the list makes the sliding layer collapse again... Anybody know how to work around that?

Zordid avatar Feb 03 '14 07:02 Zordid

Hello! The expected behavior for the SlidingLayer is to respond to swipe events (when the swipe is vertical, the list will scroll, when it's horizontal, list does nothing but sliding layer responds to it - closing or opening). Which configuration of the layer do you have? Note that the SlidingLayer is listening to events that were not consumed, as expected (ie.: if a button inside of the layer consumes the event, SlidingLayer will never hear about it, thus won't respond to it). I can't think of a case where an event is not consumed and the desired effect is for the layer to ignore it. But if that case is clear to you, a solution would be enabling and disabling sliding on the layer.

JlUgia avatar Feb 03 '14 07:02 JlUgia

Well, I got a top and bottom sliding layer in my layout, both containing a ListView. If the layer is open and you fling on the list, sometimes it triggers the sliding layer to collapse. Of course I don't want to disable sliding of the layer completely because if you do the swipe outside the list borders, I sure do want sliding... It seems that some swipe events go through the ListView right to the sliding layer...

Zordid avatar Feb 03 '14 08:02 Zordid

Okay, I found a suitable solution for the problem that ALL touch events are processed by the SlidingLayer: I attach the following onTouchListener to my ListView that is contained within the SlidingLayer:

 // disallow any touch events within the ListView to be processed by drawer
    mListView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(final View v, final MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
                mSlider.requestDisallowInterceptTouchEvent(true);
            }
            return false;
        }
    });

This way, all touch events intiated within my List are not delivered to the SlidingLayer - thus I can drag and fling in my list and NOT trigger a retract of my sliding layer.

Zordid avatar Mar 02 '14 10:03 Zordid

Hi Zordid, Its working like charm!! Thank you so much!!!

ranjithjd avatar Dec 01 '14 07:12 ranjithjd