微调框下拉列表在滚动时跳跃 [英] Spinner dropdown list is jumping while scrolling
问题描述
为什么我的微调器在滚动时跳动?我只是在做以下事情:
Why is my spinner jumping while scrolling? I'm simply doing following:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(v.getContext(), layout, textViewId, new ArrayList<String>());
adapter.setDropDownViewResource(layoutDropdown);
adapter.addAll(<DATA>);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(listener);
只要下拉列表很小,一切都可以正常工作,但是如果它变大并且可以滚动,我会看到它在滚动时会跳来跳去.为什么?
As long as the dropdown is small, everything works fine but if it gets larger and scrollable, I see that it jumps around while scrolling. Why?
在滚动时我没有更改选择或数据,所以我很惊讶这种简单的设置.有什么想法可以解决这个问题吗?
I'm not changing the selection or data while scrolling, so I'm surprised that this happens in such an easy setup. Any ideas how to solve this?
推荐答案
我遇到了这个问题.
问题是 anroidx 更新库
更新:因为Bill Bunting评论"alpha04"现在可以使用
UPDATE: as Bill Bunting comment "alpha04" is ok now
按以下版本还原应用程序兼容性:"alpha02/alpha03" ,直至"alpha04"
Resolve by revert version appcompat from "alpha02/alpha03" up to "alpha04"
实现'androidx.appcompat:appcompat:1.1.0-alpha04'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'
或更好
实现'androidx.appcompat:appcompat:1.0.2' ->更稳定
implementation 'androidx.appcompat:appcompat:1.0.2' -> for more stable
这篇关于微调框下拉列表在滚动时跳跃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!