如何将图像添加到我的微调器的每个项目中。
我的代码:
val lista = arrayOf("Kotlin","Python","Java","Mongodb","GoLand","C++")
val adaptador = ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,lista)
spinner.adapter = adaptador
when(spinner.selectedItem.toString()){
"Koltin" -> Toast.makeText(this,"Kotiin",Toast.LENGTH_SHORT).show()
"Python" -> Toast.makeText(this,"Python",Toast.LENGTH_SHORT).show()
"Java" -> Toast.makeText(this,"Java",Toast.LENGTH_SHORT).show()
"Mongodb" -> Toast.makeText(this,"Mongodb",Toast.LENGTH_SHORT).show()
"GoLand" -> Toast.makeText(this,"GoLand",Toast.LENGTH_SHORT).show()
"C++" -> Toast.makeText(this,"C++",Toast.LENGTH_SHORT).show()
}
我想用普通微调器添加图片是不可能的,如果你想给微调器添加图像,你需要制作一个自定义类“自定义微调器”