i want to add a view to a relativelayout. this view must be added to a specified position.
i have this:
int x = ...;
int y = ...;
button.setO
You might want to try setting the position of your button before you add it to the parent view. So just swap these two lines:
relativelayout.addView(button);
button.layout(x, y, x + button.getWidth(), y + button.getHeight());
to be this:
button.layout(x, y, x + button.getWidth(), y + button.getHeight());
relativelayout.addView(button);