适配器滚动视图,非滚动列表视图中显示的列表? [英] Adapter for a List displayed inside a Scroll View, non-Scrolling List View?

查看:153
本文介绍了适配器滚动视图,非滚动列表视图中显示的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前正在建设我一直在同步通过BaseAdapter数据绑定列表列表视图的应用程序。这个迄今已工作,但现在我需要有一个滚动型中的数据的列表。与把一个ListView一个滚动型内的问题是,这两种观点滚动和它使活动难以导航。从我读过的在线共识似乎是,列表视图不应该为这个原因滚动意见里面放,那一个的LinearLayout或TableLayout应改为使用。

In the app I am currently building I have been synchronizing ListViews with unbound Lists of data via BaseAdapter. This has been working so far but now I need to have a list of data inside a ScrollView. The problem with putting a ListView inside a ScrollView is that both views scroll and it make the activity difficult to navigate. From what I've read online the consensus seems to be that ListViews should never be put inside of scroll views for this reason, and that a LinearLayout or TableLayout should be used instead.

我quesion是这样的:任何一个可以告诉我,无论是如何让一个ListView摆脱滚动功能,或者如何通过一个适配器来使用的LinearLayout或TableLayout数据的列表同步

My quesion is this: Can any one tell me either how to get rid of the Scrolling Feature on a ListView or how to synchronize a List of data with a LinearLayout or a TableLayout through an adapter?

推荐答案

您可以使自己的自定义的ListView组件,然后覆盖<一个href=\"http://developer.android.com/reference/android/app/Activity.html#dispatchTouchEvent%28android.view.MotionEvent%29\"相对=nofollow> dispatchTouchEvent()方法:

You could make your own custom ListView component and then override the dispatchTouchEvent() method:

@Override
public boolean dispatchTouchEvent(MotionEvent event)
{
    int action = event.getAction();
    if (!scrollEnabled) {
        event.setAction(MotionEvent.ACTION_CANCEL);
        super.dispatchTouchEvent(event);
        return true; 
    }

    return super.dispatchTouchEvent(event);
}

在这些情况下,虽然,我在过去所做的那样是有我的名单通过code以独立垂直的LinearLayout和手动添加TextViews,使它看起来像一个列表视图。

In these kinds of situations though, what I've done in the past is have a separate vertical LinearLayout for my list and manually added TextViews via code to it, making it look similar to a listview.

这篇关于适配器滚动视图,非滚动列表视图中显示的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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