Spinner dropdown list is jumping while scrolling

时光总嘲笑我的痴心妄想 提交于 2019-12-30 06:22:09

问题


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?


回答1:


I was faced with this.

Problem is anroidx update libs

UPDATE: as Bill Bunting comment "alpha04" is ok now

Resolve by revert version appcompat from "alpha02/alpha03" up to "alpha04"

implementation 'androidx.appcompat:appcompat:1.1.0-alpha04'

or better

implementation 'androidx.appcompat:appcompat:1.0.2' -> for more stable




回答2:


This is a very annoying, but known bug fixed in 1.1.0-alpha04 of appcompat, as per the release notes Fixed AppCompatSpinnerscrolling in dropdown mode



来源:https://stackoverflow.com/questions/48328592/spinner-dropdown-list-is-jumping-while-scrolling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!