Skip to content Skip to sidebar Skip to footer

Android Ontouch Example

I have an example which I collect from Internet. public class MprojectActivity extends Activity { /** Called when the activity is first created. */ ImageView itan2;

Solution 1:

It is used to create the relative layout, there is nothing complex about it, it's really simple.

x-236 means you are setting a point on x-axis 236 unit away from the left top of the screen. y-565 means you are setting a point on y-axis 565 unit away from the left top of the screen.

by using those two values and left top value (0,0) you are creating a layout to show your image ( which is itan2 in this example)

Solution 2:

I am not sure if I understand your question, please edit it. If you want to learn something more about getRawX and getRawY, please have a look at http://developer.android.com/reference/android/view/MotionEvent.html which says:

public final float getRawX ()

Added in API level 1 Returns the original raw X coordinate of this event. For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

Same for getRawY()

Post a Comment for "Android Ontouch Example"