view - Adding a child in a GestureOverlayView on the point where i touched in android? -


how can add child(a layout) in gestureoverlayview @ point touched in view..... possible position according co ordinates of location??

for api 11 (android 3.0.x) , above: can use view.setx() , view.sety(). see api docs details.

for api versions: use relativelayout , relativelayout.layout. setting margins in fields inherited viewgroup.marginlayoutparams. guess go this:

relativelayout parentlayout = (relativelayout) findviewbyid(r.id.relative_layout);  linearlayout newlayout = new linearlayout(this); // or other layout  relativelayout.layoutparams layoutparams = new relativelayout.layoutparams(     // can enter layout absolute dimensions here instead of 'wrap_content'.     viewgroup.layoutparams.wrap_content,     viewgroup.layoutparams.wrap_content); // set x , y position here new layout. layoutparams.setmargins(100 /*left*/, 200 /*top*/, 0 /*right*/, 0 /*bottom*/);  parentlayout.addview(newlayout , layoutparams); 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -