1

enter image description here

enter image description here

i was trying to show popupwindow above the view to the right corner i have used the below code

    val minusY = UiUtil.pxFromDp(requireContext(), -300f) // this is the height of the popupwindow 300dp
    popupWindow?.showAsDropDown(achorView, 0,-minusY, Gravity.TOP or Gravity.END)
    
    
     fun pxFromDp(context: Context, dp: Float): Int {
            return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, context.resources.displayMetrics).toInt()
        }

but it gives variation from device to device.

avez raj
  • 2,055
  • 2
  • 22
  • 37

0 Answers0