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;
}

How to draw a view in a use click position How to draw a view in a use click position Reviewed by Admin on 11:05 PM Rating: 5

No comments:

Powered by Blogger.