Android list view inside a scroll view

后端 未结 30 2062
一向
一向 2020-11-21 13:43

I have an android layout which has a scrollView with a number of elements with in it. At the bottom of the scrollView I have a listView

30条回答
  •  既然无缘
    2020-11-21 14:05

    Don't do anything in Parent ScrollView. Only do this to child ListView. Everything will work perfectly.

    mListView.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    mScrollView.requestDisallowInterceptTouchEvent(true);
                   int action = event.getActionMasked();
                    switch (action) {
                        case MotionEvent.ACTION_UP:
                            mScrollView.requestDisallowInterceptTouchEvent(false);
                            break;
                    }
                    return false;
                }
            });
    

提交回复
热议问题