0 I have a requirement where I need to display popup menu , when clicked on a button in screen. I ...
b
0 I have a requirement where I need to display popup menu , when clicked on a button in screen. I used the below code for that : My question is how to change the background color of selected item in popup ? Is there a way can we customize this ? Please check the below code and help me in implementing custom popupmenu to change background of selected menu item.
Copy code
private fun showMenu(view: View) {
    val popupMenu = PopupMenu(requireContext(), view)

    popupMenu.inflate(R.menu.menu_settings_popup_list)

    popupMenu.setOnMenuItemClickListener { item: MenuItem ->
        when (item.itemId) {
            R.id.item1 -> {
               // Make some service call
                true
            }
            R.id.item2 -> {
              // Make some service call
                true
            }
            else -> false
        }
    }

    popupMenu.show()
}
not kotlin but kotlin colored 3