1

In my project I am using ScrollView to display list of products and each product will have a sub product. I am using a realviewswitcher to display the sub products. Till this everything works fine . The problem is when I scroll the scrollView it scrolls good .But while using the realviewswitcher to view the sub product (left to right swipe of the list view item) the scrollview is allows gets scrolled. I want to disable the scrollView while swiping left to right . Scrollview must work only when I swipe top to bottom.

I have tried with custom ScrollView.But I didnt get the expected result . I also used setEnabled(false) no use of it . is their any other solutions? please tell me know

Deepu
  • 313
  • 1
  • 4
  • 15

1 Answers1

2

try this

it will disable scrolling as you want(vertical/horizontal). Or you can try this:

implements setOnTouchListener for both parent scrollview and child realviewswitcher like this:

parentScrollView= (ScrollView) findViewById(R.id.parentScrollview);
parentScrollView.setOnTouchListener(new View.OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
         //Log.v(TAG,"PARENT TOUCH");
         findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(false);
        return false;
        }
    });
childScrollView= (ScrollView) findViewById(R.id.childScrollView);
childScrollView.setOnTouchListener(new View.OnTouchListener() {

    public boolean onTouch(View v, MotionEvent event) {
        // TODO Auto-generated method stub
         //Log.v(TAG,"PARENT TOUCH");
         findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(true);
        return false;
    }
});
Community
  • 1
  • 1
Chirag Shah
  • 2,048
  • 2
  • 19
  • 30