Search code examples
androidkotlindialogandroid-custom-viewpopupmenu

how to create Popupmenu with radio button


I am trying to create a popup menu with a radio I couldn't find any solution. I want to show a custom popup menu something like this

enter image description here

this is what I tried so far

imgmenuoption.setOnClickListener {
            val popupMenu = PopupMenu(mContext, it)
            popupMenu.menuInflater.inflate(R.menu.menu, popupMenu.menu)
            popupMenu.setOnMenuItemClickListener(PopupMenu.OnMenuItemClickListener { item ->
                when (item.itemId) {
                    R.id.action_logout -> logout()
                    R.id.action_setting -> startActivity(Intent(mContext, SettingActivity::class.java))
                }
                true
            })
            popupMenu.show()
        }

this is showing the popup menu but how can I show the radio button before text single selection

Please help me

Any suggestion would be helpful


Solution

  • i used Balloon library customListBalloon it solve my problem