ListView nested scrolling on API<21

六眼飞鱼酱① 提交于 2019-11-28 01:06:52

Unfortunately, there is no way to get nested scrolling working on ListView - otherwise it wouldn't require the modifications that were done in API 21.

You'll note that the current Parse SDK has actually removed ParseQueryAdapter entirely. Given that, it may make sense to start building your own RecyclerView based adapter using the Parse query APIs directly.

For those intersted in the specific ParseQueryAdapter issue,

I'm actually a Xamarin developer so I can't test if this works in this particular case, but I found an answer which helped me in Xamarin, so I'm gonna share it:

I found a solution that works excellently and can scroll the ListView without problems:

ListView lv = (ListView)findViewById(R.id.myListView);  // your
listview inside scrollview lv.setOnTouchListener(new
ListView.OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        int action = event.getAction();
        switch (action) {
        case MotionEvent.ACTION_DOWN:
            // Disallow ScrollView to intercept touch events.
            v.getParent().requestDisallowInterceptTouchEvent(true);
            break;

        case MotionEvent.ACTION_UP:
            // Allow ScrollView to intercept touch events.
            v.getParent().requestDisallowInterceptTouchEvent(false);
            break;
        }

        // Handle ListView touch events.
        v.onTouchEvent(event);
        return true;
    }
});

What this does is disable the TouchEvents on the ScrollView and make the ListView intercept them. It is simple and works all the time.

If this won't work, please tell me so I can delete this answer. But maybe it helps anyone since I also found this question and it seems to have no solution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!