1

我试图阻止列表视图滚动。我在其他主题上看到过(例如如何获得不可滚动的 ListView?)改为使用线性布局。但是,这在我的应用程序中是不可能的,我的列表视图是可编程填充的,所以我需要这个组件。感谢您的回复

编辑:在不更改我的整个代码的情况下,似乎最简单的方法是将列表视图中 scroolview 中的其他项目添加为标题,所以我不再需要 scroolview 了。

但是,listview adaper 似乎无法正常工作。我已经看到我必须使用 WrappedListadapter,但我不知道该怎么做。

这是我用来设置适配器的代码:

    SimpleAdapter mSchedule = new SimpleAdapter(this.getBaseContext(), listItem, R.layout.consultafficheitem,
           new String[] {"description", "ingredient"}, new int[] {R.id.consultlistdescription, R.id.consultlistingredients});


    scroll = (RelativeLayout) findViewById(R.id.consultscrollrelativelayout);
    liste.addHeaderView(scroll);

    liste.setAdapter(mSchedule);
4

2 回答 2

2

我会使用一个View.OnTouchListener并简单地使用类似的东西

if(event.getAction == MotionEvent.ACTION_MOVE) {
     // Ignore move events
     return true;
} else {
     return false;
}
于 2013-04-22T10:46:05.193 回答
1

到目前为止,我发现的最好方法是创建一个自定义列表。

基本上,您忽略了移动事件(发生在触地和触地之间)。但问题是当触摸一个项目时,然后将您的手指移出该项目,它仍然会触发触摸事件。

看到这个链接

于 2013-10-31T00:08:19.023 回答