【发布时间】:2020-04-24 19:43:14
【问题描述】:
以编程方式创建Spinner 后,通常位于右侧的下拉箭头由于某种原因没有出现。为什么箭头不见了,怎么显示?
spinnerItems = arrayOf(
"Cathedral of the Intercession of the Most Holy Theotokos on the Moat",
"Ferapontov Monastery",
"Historic Monuments of Novgorod and Surroundings",
"Golden Mountains of Altai",
"Historic Centre of Saint Petersburg and Related Groups of Monuments",
"Bogoroditse-Smolensky Monastery",
"White Monuments of Vladimir and Suzdal"
)
val mySpinner =
Spinner(view!!.context, null, android.R.style.Widget_Material_Spinner, Spinner.MODE_DROPDOWN)
val arrayAdapter = ArrayAdapter(view!!.context, android.R.layout.simple_dropdown_item_1line, spinnerItems)
arrayAdapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line)
mySpinner.adapter = arrayAdapter
mFrameLayout.addView(mySpinner)
【问题讨论】:
标签: android kotlin android-spinner android-dialog