GetX () is the x-coordinate of the widget relative to its upper-left corner, and Getrawx () is the x-coordinate value relative to the upper-left corner of the screen (note: The upper-left corner of the screen is the upper-left corner of the phone screen, regardless of whether the activity is titlebar or full screen ), GetY (), Getrawy () If you implement a Ontouchlistener interface in one of your activity, you need to override
OnTouch(View view,motionevent event)
This method,
GETRAWX () and Getrawy () get the position relative to the screen, GetX () and gety () are always the touch position coordinates of the view
(These two values do not exceed the length and width of the view).
If you override the activity's
Ontouchevent(motionevent event)
, this time you get the coordinates of the screen click position. Event.getx () Gets the same value as EVENT.GETRAWX (), and Event.gety () is the same as the value obtained by Event.getrawy (), but also gets the coordinate position when the title bar is touched, but the coordinate position when the status bar is touched is not available.
( Note: The activity has two segments width: one is the status bar, one is the title bar, each width is 25 pixels)
Motionevent getx (), GetY () and Getrawx (), Getrawy () difference