MotioneventGetx (), Gety (), getrawx (), getrawy ()(00:42:41)
|
Classification: Technology |
MotioneventDifference between getx (), Gety (), getrawx (), and getrawy ()
Summary: If you implement the ontouchlistener interface in an activity, you need to override the ontouch (view, motionevent event) method. getrawx () and getrawy () obtain the location relative to the screen, getx () and Gety () always obtain the coordinates of the touch position of the view (the two values do not exceed the length and width of the view ). Getx is always the X position of the view you touch, and this X is the position of the mouse relative to this view; Y is also. Getrawx is the X position of the view you touch. This is the position relative to the screen. If you override the ontouchevent (motionevent event) of the activity, the coordinates of the screen click position are obtained. Event. getx () and event. the value obtained by getrawx () is the same, event. gety () and event. the value obtained by getrawy () is the same, and the coordinates of the title bar can be obtained, but the coordinates of the status bar cannot be obtained. (Note: There are two sections of activity width: one is the status bar and the other is the title bar, each of which occupies 25 pixels) |