How to get the number of items in a spinner?
How to get the number of 开发者_运维技巧items in a spinner dynamically?
You can try:
mSpinner.getAdapter().getCount();
spinerObj.getAdapter.getCount();
for getting number of item
spinnerAdapter.getCount();
or spinnerList.size();
In Kotlin:
val spinnerCtr = binding.spinnerName.count
produces the number of list items. It starts at zero.
精彩评论