如何获取下拉列表中项目的数量?

30

如何动态获取下拉列表中的项数?

4个回答

75

你可以尝试:

mSpinner.getAdapter().getCount();

8
spinerObj.getAdapter.getCount();

获取项目数量

should getAdapter有括号吗? - andreikashin

6

spinnerAdapter.getCount(); or spinnerList.size();


0
在 Kotlin 中:
val spinnerCtr = binding.spinnerName.count

生成列表项的数量。它从零开始。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接