Having issue with Popup window
Looks like these 2 phones have different screen resolutions. So you have to use DP instead of pixels. Check this post
Popup size. Firstly you have to convert dialog size to pixels. These are random values and they are hardcoded, but you can take them from resources or harcode too.
val popUpWidthDp = 200
val popUpHeightDp = 100
val popUpWidthPx = convertDpToPx(popUpWidthDp)
val popUpHeightPx = convertDpToPx(popUpHeightDp)
val popupWindow = PopupWindow(customView, popUpWidthPx, popUpHeightPx, true)
Popup position. Firstly you need to convert dp to px and then you can calculate popup position related to screen size.
val popUpLeftSideMarginDp = 50
val popUpTopMarginDp = 100
val popUpXPoint = convertDpToPx(popUpLeftSideMarginDp)
val popUpYPoint = convertDpToPx(popUpTopMarginDp)
popupWindow.showAtLocation(linearLayout1, Gravity.CENTER, popUpXPoint, popUpYPoint)
Check out this answer to understand how to convert dp into pixels and vise versa.
If popup should have size and position related to screen size then you have to change these values:
popUpHeightPx, popUpWidthPx - popup size
popUpXPoint, popUpYPoint - popup position
Let me know if you need detailed explanation.