Closed dipcore closed 5 years ago
Hi @dipcore,
I think this should be possible with a customItem
and viewBoundCallback
. In the sample app there's e.g.
customItem {
layoutResId = R.layout.view_custom_item_checkable
viewBoundCallback = { view ->
val checkBox: CheckBox = view.findViewById(R.id.customItemCheckbox)
checkBox.isChecked = true
}
callback = {
Toast.makeText(this@LightActivity, "Disabled!", Toast.LENGTH_SHORT).show()
}
}
so in viewBoundCallback
you do sth like view.isFocused = true
and check if it does the trick.
Let me know if this helped!
Hey @zawadz88 Yes, that worked. Here is my code
customItem {
layoutResId = R.layout.mpm_popup_menu_item
viewBoundCallback = { view ->
view.findViewById<TextView>(R.id.mpm_popup_menu_item_label)
.text = option.name
if (option.name == model.value)
view.post { view.requestFocus() }
}
callback = {
...
}
}
So I have to use view.post { view.requestFocus() }
to make it work properly.
Thanks for your help
Is there a way to set which item is selected/focused on menu opening? for instance I have menu