问题描述
我有一个ListView三个项目。我选择在ListView的原因是这样我就可以使用这些项目一个分频器和一个列表选择。
I have three items in a ListView. The reason I have chosen the ListView is so I can use a Divider and a List Selector on these items.
不过,我并不需要/想在ListView的滚动方面。 IE浏览器。当我从列表中选择/拖动项目,我不希望它滚动..
However I do not need/want the scrolling aspect of the ListView. Ie. When I select/drag an item from the list, I dont want it to scroll..
是否有可能以某种方式禁用此?或将我使用的LinearLayout新增的项目,找到使用列表分频器和选择的另一种方式?
Is it possible to disable this somehow? Or will I have to add the items using a LinearLayout and find another way of using a list divider and selector?
推荐答案
我不知道如何这会为你工作,但你可以(在Android的9及更高版本)禁用反弹时:
I'm not sure how well this will work for you, but you can disable overscroll (available in android-9 and above):
listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
,然后还隐藏滚动条:
and then also hide the scroll bars:
listView.setVerticalScrollBarEnabled(false);
在此,如果你的列表不超过屏幕大小就应该不能够滚动。
After this, if your list does not exceed the screen size then it shouldn't be able to scroll.
这篇关于滚动的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!