用于在滚动视图、非滚动列表视图中显示的列表的适配器?
在我当前正在构建的应用程序中,我一直在通过 BaseAdapter 将 ListView 与未绑定的数据列表同步。到目前为止,这一直有效,但现在我需要在 ScrollView 中有一个数据列表。将 ListView 放入 ScrollView 中的问题是两个视图都会滚动,并且会使 Activity 难以导航。从我在网上读到的内容来看,共识似乎是,出于这个原因,ListViews 永远不应该放在滚动视图中,而应该使用 LinearLayout 或 TableLayout 来代替。
我的问题是:谁能告诉我如何摆脱 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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以制作自己的自定义 ListView 组件,然后覆盖 dispatchTouchEvent() 方法:
不过,在这种情况下,我过去所做的是为我的列表创建一个单独的垂直 LinearLayout,并通过代码手动添加 TextView,使其看起来类似于列表视图。
You could make your own custom ListView component and then override the dispatchTouchEvent() method:
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.