So here's my layout structure:
- RelativeLayout (full screen)
- FrameLayout (full screen)
- Button (in the middle of the screen)
- RecyclerView (align parent bottom but with very big padding top to
capture the scrolling also in the top of the screen, so it's basically acting like a full screen `RecyclerView`)
So yes, the views are overlapping each other.
As of the reason the RecyclerView is the topmost view, it captures all the touch events on screen, and swallows them, preventing any touches to "go through it" to the underlying views below it. (Note: by underlying views, I don't mean to the RecyclerView's children but the other rootview's children)
I've read tons of stackoverflow posts regarding propagating touch events and preventing swallowing touch events, etc, and even though it seems pretty straightforward task to accomplish, I couldn't achieve the following effect:
I want my RecyclerView to capture the touch event, so it will scroll or whatever. but I want the rootView to think as that the RecyclerView didn't capture the event, and continue pass it to its other children (rootview'
s children).
Here's What I've tried to do:
1. Overriding dispatchTouchEvent of the RecyclerView to do its logic and return false to act as it didn't dispatch its touch event so the rootview will keep iterating for touch through its child views.
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
super.dispatchTouchEvent(ev);
return false;
}
What happened:
The RecyclerView still functions but still swallows all touch events (just the same as before)
2. Overriding onTouchEvent of the RecyclerView to do its logic and return false. (Note: I know it doesn't seem as it would be the solution but I tried)
@Override
public boolean onTouchEvent(MotionEvent e) {
super.onTouchEvent(e);
return false;
}
What happened:
Same result as in #1
I've made some more tweaks with the same idea, but they didn't work as well, so I'm kinda clueless right now and would love for help of you fellows!