0

I'm working on an App with Android Studio(Java) and want a ScrollView inside a ScrollView.

If I scroll the small one to the end it automatically starts scrolling the big one, is it possibile to disable the scrolling function of the big one when scolling the small one?

Henry
  • 42,982
  • 7
  • 68
  • 84
Anon
  • 21
  • 3

1 Answers1

0

You need to handle this by disabling the other ScrollView when scrolling the current one

Let's say you have scroll_view_parent and scroll_view_child

parentScrollView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            findViewById(R.id.scroll_view_child).getParent()
                    .requestDisallowInterceptTouchEvent(false);
            return false;
        }
    });

childScrollView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            v.getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });
Hayssam Soussi
  • 903
  • 7
  • 16