如何工作的,在里面滚动视图列表视图? [英] How to work, when listview inside the scrollview?

查看:103
本文介绍了如何工作的,在里面滚动视图列表视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做这在 Android 1.6及2.2

我有一个 滚动型在活动(所有的滚动型的内容)...

I have One ScrollView in the Activity (All the content in the ScrollView) ...

二是,其中的的ListView 的活动......

And Second is, One ListView in the Activity ....

当我滚动的ListView,当时滚动型的滚动而 ListView的滚动无法正常工作

When I Scroll ListView, at that time ScrollView is scrolling but ListView's Scroll is not working ...

我公司提供的 scatch 问题,我有...

I provide the scatch of the problem which I have ...

如果任何人有这样的解决方案,那么请分享...

If anyone have solution of this, then please share ...

推荐答案

在这里parentScroll =主滚动视图 和childScroll =您的ListView

here parentScroll = your main scrollview and childScroll = your listview

parentScroll.setOnTouchListener(new View.OnTouchListener() {

                public boolean onTouch(View v, MotionEvent event) {
                    Log.v("PARENT", "PARENT TOUCH");
                    findViewById(R.id.child_scroll).getParent()
                            .requestDisallowInterceptTouchEvent(false);
                    return false;
                }
            });

  childScroll.setOnTouchListener(new View.OnTouchListener() {

                public boolean onTouch(View v, MotionEvent event) {
                    Log.v("CHILD", "CHILD TOUCH");
                    // Disallow the touch request for parent scroll on touch of
                    // child view
                    v.getParent().requestDisallowInterceptTouchEvent(true);
                    return false;
                }
            });

这篇关于如何工作的,在里面滚动视图列表视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆