java - Android Spinner not responing to clicks, does not close and OnItemSelectedListener does not fire off -
i developing app in kotlin (if don't know kotlin sure can still android/java experience)
details:
i have spinner in there app.though not responding clicks once pops , shows weird views. , because of onitemselected listener never fired either.
i start method update spinner asyncrealm call.
here's code:
this whole function runs, spinner not null, after attaching listener, no longer null either (when debugging).
private fun updatecategoryspinner(result: mutablelist<category>) { info("updatecategoryspinner") val arrayadapter: arrayadapter<string> = arrayadapter(ctx, r.layout.spinner_item, result.map{ it.category }) arrayadapter.setdropdownviewresource(r.layout.spinner_item) arrayadapter.notifydatasetchanged() categoryspinner.adapter = arrayadapter info("updatecategoryspinner done") } result.map{..} creates mutablelist category names.
problem:
i have no idea why there arrows, no matter layout use (even if simple textview) there
what missing here?
disabling listener doesn't help.
attaching listener anko doesn't help.
the listener fires once when initialized, that's it.
once dropdown opens stuck.
i creating views anko.
the r.layout.spinner-item <textview>.
class addtodofragmentui:ankocomponent<viewgroup>,ankologger { override fun createview(ui: ankocontext<viewgroup>): view { val edittexttheme = r.style.widget_appcompat_edittext return with(ui){ verticallayout { info("inverticallayout") verticalpadding =dip(15) gravity = gravity.center edittext(edittexttheme){ id = r.id.txt_todo_desc hintresource = r.string.txt_todo_desc_hint width = matchparent } spinner(r.style.widget_appcompat_spinner){ id= r.id.spinner_todo_category prompt = "select category" } button{ id = r.id.btn_add_todo textresource = r.string.btn_add_todo width = matchparent } button{ id = r.id.btn_del_todo textresource = r.string.btn_del_todo width = matchparent visibility = view.invisible } }.applyrecursively {view -> when(view){ edittext -> view.textsize = 20f button -> view.textsize = 30f } } } } image:
okay, issue of non-responsiveness setting widget_app_compact spinner theme.
spinner(r.style.widget_appcompat_spinner){ id= r.id.spinner_todo_category prompt = "select category" removing solves problem.
don't lose 2 days did on this, please :d.

Comments
Post a Comment