I have one button in an AbsoluteLayout in an XML file. From there I am able to set the (x,y) position of the button.
How can I get and set the (x,y) coordinates of the button programmatically?
Thanks all.
You have to get a reference to you button, for example by calling findViewById(). When you got the reference to the button you can set the x and y value with button.setX() and button.setY().
....
Button myButton = (Button) findViewById(R.id.<id of the button in the layout xml file>);
myButton.setX(<x value>);
myButton.setY(<y value>);
....