ListView in SlidingDrawer loses focus after onResume

I am using SlidingDrawer as the main layout. Inside the content area, I have a fragment (which contains a ListView). When the activity first loads, everything is fine, the listview scrolls correctly.

When I start another action and then return, the first scroll I try intercepts SlidindDrawer and opens or closes it. Once you stop the scroll and take your finger, the ListView will be able to scroll again.

I would like ListView to be able to scroll when activity resumes. And as a rule, you can control whether SlidingDrawer is the one who gets the focus.

UPDATE:

I narrowed down the problem a bit. I expanded SLidingDrawer to allow clicking on buttons in the descriptor with the following code.

Override
public boolean onInterceptTouchEvent(MotionEvent event) {
    super.onInterceptTouchEvent(event);

    if (mHandleLayout != null) {
        int clickX = (int) (event.getX() - mHandleLayout.getLeft());
        int clickY = (int) (event.getY() - mHandleLayout.getTop());

        if (isAnyClickableChildHit(mHandleLayout, clickX, clickY))
            return false;
    }
    return super.onInterceptTouchEvent(event);
}

private boolean isAnyClickableChildHit(ViewGroup viewGroup, int clickX, int clickY) {
    for (int i = 0; i < viewGroup.getChildCount(); i++) {
        View childView = viewGroup.getChildAt(i);

        if (TAG_CLICK_INTERCEPTED.equals(childView.getTag())) {
            childView.getHitRect(mHitRect);

            if (mHitRect.contains(clickX, clickY))
                return true;
        }

        if (childView instanceof ViewGroup && isAnyClickableChildHit((ViewGroup) childView, clickX, clickY))
            return true;
    }
    return false;
}

onInterceptTouchEvent, .

+5
1

, super.onInterceptTouchEvent(event) . ? .

0

All Articles