【发布时间】:2010-07-19 17:20:19
【问题描述】:
我一直在尝试在 android 中动态更新我的微调器,但我没有尝试任何工作。
这是我用来更新微调器的以下代码。
typeList = dbAdapter.getList(); //array list with the values
adapter.notifyDataSetChanged();
groupSpinner.postInvalidate();
groupSpinner.setAdapter(adapter);
typeList 的值是正确的,但它们没有在 Spinner 中更新。
【问题讨论】:
-
我通过创建一个全新的适配器解决了这个问题......我觉得我不应该这样做。
-
你有一个适配器实例吗?如果你再次初始化你的适配器 notifyDataSetChanged 不起作用。