I am developing an application in Kotlin (if you do not know about kotlin, I am sure that you can still help with your Android / Java experience)
Details:
I have Spinner there my application. Although he does not respond to clicks as soon as he appears, and even shows some strange looks. And because of this, the OnItemSelected listener also does not start.
I am running a method to update the counter from an AsyncRealm call.
Here is the code:
All this function works, the counter is not equal to zero, after adding a listener, it is no longer zero (during 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 a MutableList with category names.
Problem:
I have no idea why there are these arrows, but no matter what layout I (even if just a simple TextView) they are there
What am I missing here?
Disabling the listener does not help.
Attaching a listener with Anko does not help.
The listener starts once when it initializes what it is.
As soon as the drop-down menu opens, it is completely stuck.
I create my views with Anko.
R.layout.spinner-item is just a <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 a 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){ is EditText -> view.textSize = 20f is Button -> view.textSize = 30f } } } }
Picture
