How to draw a view in a use click position

NewImage


 


The best way to show a view in a position that user click is by using onTouchEvent methoid. The method will retrieve MotionEvent and you
can retrieve the boolean value. You can also put relativeLayout as main layout and you should get a user click and you should get the coordinate of user’s click. 


 


public boolean onTouchEvent(MotionEvent event) {

super.onTouchEvent(event);

//todo
return true;
}

No comments:

Post a Comment