I have a view, I want to place it at (x, y) position via WindowManager.LayoutParams.
My code is:
mHeadLayoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT);
mHeadLayoutParams.gravity = Gravity.TOP | Gravity.END;
mHeadLayoutParams.x = -20;
mHeadLayoutParams.y = _screenSize.y * 15 / 100;
But mHeadLayoutParams.x = -20 does not same on others device screen. How can I calculate this value to my view placed on same position on multi device screen?
Sorry for my bad english.