I've created a PopupWindow with a rounded background, like this:
val popupWindow = PopupWindow(requireContext())
val roundedBackground = ResourcesCompat.getDrawable(resources, R.drawable.popup_menu_background, requireContext().theme)
popupWindow.setBackgroundDrawable(roundedBackground)
And I'm using it as a dropdown, with a ListView and an Adapter:
val listView = ListView(requireContext())
listView.adapter = currencySpinnerAdapter
popupWindow.contentView = listView
When clicking on an item, the ripple effect doesn't clip to the PopupWindow's rounded background. As you can see, this ripple doesn't match the top corners of the PopupWindow:
I've tried changing the ListView's background to add a ripple drawable:
listView.setBackgroundResource(R.drawable.my_ripple)
The ripple does match the PopupWindow's contents, but it expands to the whole PopupWindow instead of matching the specific clicked item.
Is there any way to reach this desired effect?