Android: Change absolute position of a view programmatically

Use the version of addView that takes LayoutParams:

LayoutParams params = mLayout.generateLayoutParams();
params.x = remoteObject.x;
params.y = remoteObject.y;
mLayout.addView(button, params);

Leave a Comment