Search code examples
androidandroid-windowmanagerlayoutparams

Is the WindowManager.LayoutParams x/y position 1-based or 0-based?


Are the x/y positions of a window declared as 1-based? (in other words inclusive of the first pixel of the window), so that with x=1 and y =1 the window would fit in the left top corner without having a 1px gap before its left and top edges?

If that's the case would setting x/y to 0/0 be valid and allowed? Would that cause the window to hang out of the screen area by 1px?


Solution

  • The left top corner corresponds to 0/0 as x/y

    UPDATE: Refer to this question on stackoverflow How do android screen coordinates work?