Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Flickering of fragments when using ObservableScrollView or ObservableListView #25

Closed
jaredrummler opened this issue May 17, 2015 · 6 comments

Comments

@jaredrummler
Copy link
Contributor

This is an issue in Android-ObservableScrollView. See: ksoichiro/Android-ObservableScrollView#117

To fix it you could add the following code in registerScrollView and registerListView in MaterialViewPagerAnimator.

public void registerScrollView(final ObservableScrollView scrollView,
        final ObservableScrollViewCallbacks observableScrollViewCallbacks) {
    if (scrollView != null) {
        scrollViewList.add(scrollView); // add to the scrollable list
        // fix flickering
        scrollView.setTouchInterceptionViewGroup((ViewGroup) scrollView.getParent().getParent());
        ...
public void registerListView(final ObservableListView listView,
        final ObservableScrollViewCallbacks observableScrollViewCallbacks) {
    if (listView != null) {
        scrollViewList.add(listView); // add to the scrollable list
        listView.setTouchInterceptionViewGroup((ViewGroup) listView.getParent().getParent());
        ...

This will use the RelativeLayout in material_view_pager_layout.xml as the ViewGroup. Inspired by this workaround: ksoichiro/Android-ObservableScrollView@f17e3ce

@florent37
Copy link
Owner

can you do create a pull request with this code please ?

@nurzhannogerbek
Copy link

@florent37 Check this. Its the same as here Click here

@florent37
Copy link
Owner

thanks for your help 👍 I really appreciate it 😄
I sent it to the 1.0.3.3

@Anearion
Copy link

Is this fixed somehow ? I'm experiencing this right now. My third tab is an observableScrollView and if I touch the content this fragment flick to my second tab tab, which is a recyclerview.

EDIT:

just updated to 1.1, problem still here tho

@egor-n
Copy link

egor-n commented Sep 16, 2016

For anyone still encountering this issue, your registerScrollView should happen after the view has been attached to the window.

There is a condition for the ScrollView's parent to be not null, which can be false in onCreateView, for example.

@youtoou2
Copy link

@Anearion thanks to @egor-n , just register your scrollview after onStart() to make sure the view is attached. I'm having the same issue and registering it in onCreateView() , finally it is working fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants