我需要制作一个自定义窗体(显示x个字段)。 还有就是我创建一个微调列表对象的方式:以编程方式填充微调器android studio
Spinner[] listeCouleurs = new Spinner[nbEquipes];
listeCouleurs: is the name of the list
nbEquipes: is an int, (number of teams)
还有就是我要插入到列表中的元素(listeCouleurs):
ArrayList<String> couleurs = new ArrayList<String>();
couleurs.add("Rouge");
couleurs.add("Bleu");
couleurs.add("Vert");
couleurs.add("Rose");
couleurs.add("Jaune");
然后,有我把元素插入x spinner的方式:
listeCouleurs[i] = new Spinner(this);
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,listeCouleurs[i], couleurs);
但是,有这个错误:
Error:(94, 48) error: no suitable constructor found for ArrayAdapter(ConfigGame,Spinner,ArrayList) constructor ArrayAdapter.ArrayAdapter(Context,int,int) is not applicable (argument mismatch; Spinner cannot be converted to int) constructor ArrayAdapter.ArrayAdapter(Context,int,String[]) is not applicable (argument mismatch; Spinner cannot be converted to int) constructor ArrayAdapter.ArrayAdapter(Context,int,List) is not applicable (argument mismatch; Spinner cannot be converted to int)
如何解决此问题?
问候
你有错误信息中写的答案。它需要最基本的一般编程知识来解决这个问题。在开始提问SO之前,请先学习基础知识。 –